Tagged Questions
2
votes
2answers
57 views
Calling bash from sh (dash) with commands read from args, and “Unterminated quoted string”/“unexpected EOF”
Just thought I'd document this: I'm trying something very simple - set env variable in bash, and print it out:
$ bash -c "a=1; echo a$a;"
a
$ bash -c "a=1; echo a\$a;"
a1
Now I'd want this same ...
1
vote
1answer
75 views
How to prevent double escaping?
I'm trying to put a bunch of images together into a pdf. I ran gm convert *.jpg out.pdf and it worked, but the images were not in the right order.
I found that ls -v orders them correctly so then I ...
2
votes
1answer
53 views
Confused about when to escape metacharacters in pathnames
I'm pretty confused about under which circumstances do I need to escape metacharacters in pathnames. Consider the following example:
I'm in the following working directory:
$ echo $PWD
...
2
votes
1answer
178 views
Trouble in script with spaces in filename
I've got a script that scp's a file from remote host back to local. Sometimes the file names contain spaces. scp does not like spaces in its file names. For some reason my attempts at handling the ...
2
votes
1answer
191 views
Shell escape characters for sh -c
I need to execute a command with escaped argument(s) using sh -c. I know the string looks pretty ugly but simple ones don't cause a problem.
The output of the echo when passed to sh -c is different ...
3
votes
1answer
131 views
Printing colored text using script
When I type below command in the shell I get the OUTPUT in green color.
Command
echo "\033[32mCONNECTING TO abpwrk\033[m";
Output(in green color)
CONNECTING TO abpwrk
But if I use the same ...
7
votes
2answers
1k views
inline double and single quote escaping
I'm having trouble with escaping characters in bash. I'd like to escape single and double quotes while running a command under a different user. For the purposes of this question let's say I want to ...
2
votes
2answers
466 views
How to escape < or > in a parameter in shell?
I'd like to use grep with a PCRE expression that contains the < character. Bash thinks I want to redirect, but I don't want to. How can I escape <?
3
votes
2answers
323 views
Unix Shell and colours
Can any one please help me understand this code snippet that I found in .profile file
echo -en "\e[32;44m $(hostname) \e[m";echo -e "\e[m"