I have a problem that
1. my laptop is X86 win7 & install a virtual box.
2. Based on virtual box, I installed a Ubuntu.
Now I share a folder between win7 & Ubuntu.
And edit a bash file on windows by, ex UltraEdit.
After then, when I run the bash on Ubuntu.
It said:
mkdir: cannot create directory ‘dvbpsi\r’: Protocol error
cp: cannot stat 'src/table/.h': No such file or directory*
It seems that \r is wrong.
Instead, if I tried to store in virtual box, it shows the wrong msg below:
It seems that I CANNOT store anything from virtual OS to a shared folder.
Is there a smart way to resolve it?
Thanks in advance!!
UltraEdit can create, edit and save text files with DOS (\r\n) or UNIX (just \n) or MAC (just \r) line terminators.
The line terminator type is indicated for active file in status bar at bottom of UltraEdit main window.
The conversion between the various line terminator types can be done at any time in UltraEdit using for example the DOS to UNIX conversion command or on using Line terminator option in Save As dialog.
The default line ending type for new files can be also configured in configuration at
Advanced - Settings/Configuration - File Handling - DOS/Unix/Mac Handling.
I suggest following configuration settings for using UltraEdit mainly for editing Windows text files and only sometimes for Unix shell scripts:
Default file type for new files ... DOS
Unix/Mac file detection/conversion ... Automatically convert to DOS format
Only recognize DOS terminated lines (CR/LF) as new lines for editing ... not checked
Save file as input format (Unix/Mac/DOS) ... checked
Status bar shows original line terminator format (on disk) ... checked
So creating/editing shell scripts on Windows with UNIX type of line termination is easy using UltraEdit on Windows being also available for Linux and Mac.
Related
I have a .cpp file that I wrote on my Windows 8 computer and I am trying to paste its code into my schools Unix based system via Putty SSH client. The editor that is used on the Unix machines is the Vi editor. When I copy all the code from my .cpp file in my Windows computer and right click on the Vi editor and paste, the code shows up but its all over place and I can't even read it(I am pretty sure it wouldn't compile either). Is there a way to fix it so the code maintains its formatting in the Vi editor ? Thanks for any help !
There is usually a unix utility called dos2unix and one called unix2dos which will convert your file to dos or unix format.
If you have those it should just be a matter of:
dos2unix myfile.cpp myfile.cpp
Also, instead of pasting it into your editor try using pscp to copy the file to your target machine.
pscp myfile myname#hostname:/mydirectory/myfile
I think you must be getting beaten by the difference in the line endings of windows and unix.
You can try using editor like Notepad++ and save the file on windows.
Open the file in Noteapd++ and Edit -> EOL Conversion -> UNIX Format and save
We are trying to generate a bash shell script for use on a Linux system from values stored in a Google spreadsheet and we are having difficulties.
I can create the script contents fine and save the resultant file to Google drive but the problems come about when I try to use the file on a Linux box. When the file is downloaded as plain text the encoding is set to UTF-8 which Linux thinks is a binary file when I try to execute it. The other problem we are having is the line endings are forcibly set to the host PC which is a windows box so I get CRLF not LF as required by the Linux machine. I was wondering if there was anyway in Google app scripting to forcibly give me ASCII encoding and UNIX line ending somehow. I'd rather not have to pipe the file contents through strings and dos2unix before being able to use it.
I have a DreamHost server, and I would like to install the fileinfo extension.
I managed to create a custom php.ini file that's cool, but I'm totally stuck at this part in their documentation:
Please make sure to run 'dos2unix fileinfo_ext.sh' from the shell if you use a Windows-based editor to create this file.
So I am on Windows and running PuTTY and I have no clue about this part.
I copied fileinfo_ext.sh to my cgi-bin directory where my custom php.ini file is, but how do I go further? I'm totally lost how to run this command.
How can I do it?
"dos2unix" is a utility used to convert file from Windows line endings (CR+LF) to Unix line endings (LF).
So if you use Notepad to edit the file it will have Windows line endings. So dos2unix should be used on your computer (for that file) before sending it by FTP (or executing it on the host if you have ssh access and they have dos2unix).
But if you already use an editor which supports converting to Unix line endings, like UltraEdit or Notepad++ then all you need is to do a "convert to Unix" before saving the file.
You run the command as explained in the message. SSH to the server and login. Then cd to the location of the file, something like cd /path/to/your/site/cgi-bin and then run dos2unix fileinfo_ext.sh.
I hope this helps.
So I do a little work from time to time on Linux and today I needed to document some text files copied from the terminal window. The only problem was that I brought a linux text file over to notepad on my Win7 comp, and I noticed that all the carriage returns were removed from the text.
Is there any way to quickly add the carriage returns back in?
You can do the conversion before the transfer:
unix2dos -o <pattern>
In case you need to keep the old files or you have only read access to them:
unix2dos -n <original-file> <converted-file>
You might not have this utility available by default in your linux distro in which case you will need to install the tofrodos package.
Use Notepad++ instead of Notepad. It's free and it has a lot of functionality, including proper handling of EOL marks.
I have ��� chars after each time I save file in windows for some folders. And for some other folders - all is fine. I can't find difference between folders where everything is fine and folders where files saving with bad endings. So I have to run dos2unix in my linux virtual machine on modified files every time. Since these files is javascript - it's very annoying!
Help me, where to dig? How to avoid appearing of ��� chars at the end of file?
:set fileencoding=utf-8 does not help.
Usually vim has for dos files - [dos] label at the bottom of buffer window - in my case all is fine, and no [dos] label there.
This looks more like a file format problem than encoding. I recommend adding this to your ~/_vimrc:
set fileformat=unix
set fileformats=unix,dos
set nobinary
You can find more details in :help fileformat