Tagged Questions
2
votes
3answers
89 views
Treatment of backslashes across shells
How do echo and printf treat backslashes in zsh, bash and other shells?
Under zsh I get the following behavior:
$ echo "foo\bar\baz"
foaaz
$ echo "foo\\bar\\baz"
foaaz
$ echo 'foo\bar\baz'
foaaz
$ ...
6
votes
2answers
104 views
When is double-quoting necessary?
The old advice used to be to double-quote any expression involving a $VARIABLE, at least if one wanted it to be interpreted by the shell as one single item, otherwise, any spaces in the content of ...
2
votes
1answer
122 views
tcsh vs zsh. Escape/control characters
I am having problems running this command to work in zsh:
my_command -u something -s X:^0
The command works right away on tcsh, but on zsh I get:
zsh: no matches found -s X:^0
This made me ...
1
vote
1answer
88 views
Frequent command “template”: remove parameter expansion escape characters
zsh newbie here... I find myself using a handful of long commands over and over again with slightly different arguments. For example:
rsync -havu --progress --rsh='ssh -l mylogin' ...
3
votes
3answers
147 views
Zsh function with su and echo
I'm trying to add a function to my .zshrc that makes adding new USE flags to my /etc/portage/package.use file easier. Normally, I'd have to do
su -c 'echo "net-misc/aria2 bash-completion bittorrent" ...
3
votes
1answer
92 views
Escaping quotes for scp
I needed to write a that behaves correctly with nasty (spaces, braces, etc..)
filenames.
scp -rv "$1" shiny:/Volumes/Seagate3To/\"$1\"
This function works, but I don't understand why the quotes ...
1
vote
2answers
128 views
How to scp folders with nasty names using a shell function
I am trying to write a function that I will put on all my machines in order to make it easy to send files at a fixed place on my network.
Here is my script so far. Some folder may have duplicates ...
2
votes
2answers
183 views
Piping paths with different types of quotes for slash substitution
I would like to use sed to convert a path with backslashes to the same path with forward slashes:
E.g.
I would like to pipe \\path\to\file\ and obtain /path/to/file
None of the following commands ...
1
vote
2answers
294 views
Weird zsh grep -P behaviour
I connect to server with PuTTY from Windows.
I have a long yet not touched (I suppose) by hands of local admin config:
$ cat /opt/jira/.subversion/config
...
### must be enabled, which is ...
4
votes
1answer
140 views
printing a string's “canonical print-escaped form”
I'm trying to write a function, I'll call it escape, that will behave like this:
% IFS=$' \t\n\000'
% escape FOO $IFS
FOO=$' \t\n\000'
In other words, escape takes two arguments, and then, taking ...
2
votes
1answer
383 views
Wrapping a command that includes single and double quotes for another command
I recently learned about watch, but am having trouble making it work with relatively sophisticated commands.
For example, I would like to ask watch to run the following command on zsh every three ...