chebe: (Default)
[personal profile] chebe
In a very long script I have to construct several paths for use. Problem is the paths are getting mangled. Most easily seen with echo.
For example:
var = /opt/big_program
new_var = ${var}/sub_folder
echo "Look at what happens: ${new_var}"

/sub_foldert happens: /opt/big_program

The end of the first variable must contain a 'return line' character, and is resetting the cursor before it continues, overwriting what's already there. Chances are this file (or one it reads the paths from) was created on Windows, which uses a different character to signal the end of a line.

To fix, run:
sed -i 's/\r//' $file_name

Props, and endless thanks to the poster of the solution here:
Anonymous (will be screened)
OpenID (will be screened if not validated)
Identity URL: 
Account name:
If you don't have an account you can create one now.
HTML doesn't work in the subject.


If you are unable to use this captcha for any reason, please contact us by email at

Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.
Page generated 2017-Oct-21, Saturday 12:59 am
Powered by Dreamwidth Studios