1
vote
1answer
25 views

Expansion in zsh prompt

I'm struggling with zsh prompt, trying to convert my bash prompt to zsh hooks. This code should display the current kerberos ticket and update accordingly, but colors don't work, neither does the ...
2
votes
3answers
62 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), ...
2
votes
2answers
99 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 ...
2
votes
3answers
310 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 $ ...
10
votes
1answer
490 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
206 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
101 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
182 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
135 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
174 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
4answers
319 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
461 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
227 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 ...
3
votes
1answer
1k 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 ...