All Questions
44
questions
3
votes
3
answers
423
views
How to alias a command with '
I wanted to make an alias turn caps lock off:
python -c 'from ctypes import *; X11 = cdll.LoadLibrary("libX11.so.6"); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display, c_uint(0x0100), ...
4
votes
2
answers
3k
views
Zsh possibly adding quotes to variable value (works in bash though)
I'm fairly new to zsh (shifted yesterday from bash)
I had a bash function in bash like
vl() { cmd=`echo $1 | sed -r 's/(.+):([0-9]+).+/\1 +\2/g'`; vim $cmd }
This basically converts a argument like:...
13
votes
3
answers
30k
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\...
181
votes
1
answer
78k
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
1
answer
668
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
1
answer
177
views
Frequent command "template": remove parameter expansion escape characters
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' some.machine.somewhere:/some/path /...
3
votes
3
answers
968
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
1
answer
2k
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 ...
2
votes
2
answers
478
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 ...
3
votes
4
answers
2k
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
2
answers
3k
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 ...
6
votes
1
answer
2k
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 ...
17
votes
1
answer
22k
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 ...
29
votes
3
answers
30k
views
Escaping quotes in zsh alias
Following on from this question about stripping newlines out of text, I want to turn this into a zsh alias as follows:
alias striplines=' awk " /^$/ {print \"\n\"; } /./ {printf( \" %s \",$0);}"'
I'...