You are not logged in.
Hi,
I'm having problems finding a method to "escape" percent signs in a ZSH command line: i.e.
stat --format='%a %g %U' ~/test
%U gets interpreted by zsh (zle?) and mess with the output of the command.
I tried to use backspace, single and double quotes around %, but I didn't menage to make ZSH ignore it.
Is there any option that needs to be set?
Thanks
Offline
Not familiar with ZSH, but generally when % are being used in a printf manner, you use %% to print a literal one.
Offline
Unfortunately %% doesn't work, since stat will not interpret what I want it to print... this is something specific to ZSH.
Thanks for your prompt reply, nonetheless.
Offline
Try replacing the single quotes with double quotes:
barrucadu on azathoth in ~ [branch: master]
>>> stat --format="%a %g %U" ~
700 100 barrucadu
Offline
That command works here.
stat --format='%a %g %U' ~/inte
700 1000 milo
I even tried with ROOT user that has no zshrc. Same result. Maybe you have a globbing option set/unset?
read 'manpage zshoptions'
And try:
setopt
This will show options that are Set which are NOT default.
You can also type:
setopt kshoptionprint
setopt
And see what is set and isn't set, compare to manpage descriptions.
Here's what I have with 'nokshoptionprint' and typing 'setopt':
alwaystoend
autocd
autocontinue
autonamedirs
autopushd
nobeep
bsdecho
chaselinks
noclobber
completealiases
completeinword
correct
cshjunkieloops
extendedglob
noglobalexport
noglobalrcs
globdots
nohistbeep
histexpiredupsfirst
histfindnodups
histignoredups
histignorespace
histnofunctions
histnostore
histreduceblanks
nohistsavebycopy
histverify
incappendhistory
interactive
nolistbeep
listpacked
login
longlistjobs
markdirs
numericglobsort
promptbang
promptsubst
pushdignoredups
shinstdin
vi
warncreateglobal
So these are NOT default and they're set.
But again, the command even works with users that have no .zshrc file.. for me anyway.
Last edited by milomouse (2010-11-04 14:57:47)
Offline
Milomouse thanks for your suggestions... indeed I should have tried not loading .zshrc
I found the cause of the problem:
case $TERM in
xterm*)
precmd() { print -Pn "\e]0;%n@%m:%~\a" }
preexec () { print -Pn "\e]0;$1 %n@%m\a" }
;;
esac
Everything is ok if I remove $1 from the preexec function, but I want to see the job name in the window's title.
Any ideas?
Offline
not quite..
try also: echo -n "1\n2"
Arch64/DWM || My Dropbox referral link
Offline
I saw this post only now.
'%' is what is creating problems. Use ${~1:gs/%/%%} instead of $1 to quote it.
Offline
Thanks a lot!
Offline