77,012 reputation
1082181
bio website
location European Union
age
visits member for 1 year, 11 months
seen 58 secs ago

Jun
12
revised How can we know who's at the other end of a pseudo-terminal device?
added 184 characters in body
Jun
12
comment How can we know who's at the other end of a pseudo-terminal device?
@slm, no, in other words, I want to find out which xterm/sshd/script/screen/tmux/expect/socat... is at the other end of /dev/pts/4. Usually, that will be a common ancestor of those processes that have /dev/pts/4 open, but not necessarily.
Jun
12
awarded  Nice Question
Jun
11
awarded  Nice Answer
Jun
11
comment Run two commands on one argument (without scripting)
Assuming the file names don't contain double quote, backslash, dollar, backtick, }... characters and don't start with -. Some printf implementations (zsh, bash, ksh93) have a %q. With zsh, that could be: printf 'stat %q; file %1$q\n' ./* | zsh
Jun
11
comment How to get a string between two special characters using Shell?
Leaving a variable unquoted in list context is the split+glob operator (the variable is split into words and each word is subject to globbing), that's independent of echo. Try with string='* *' for instance. Or with string=/home/oracle/ggs/text.ext where IFS is /.
Jun
11
comment How to get a string between two special characters using Shell?
echo oracle/ggs will answer your question. Please clarify what the requirement are. Is that characters 7 to 16? From the 2nd to 4th /?
Jun
11
answered How to get a string between two special characters using Shell?
Jun
11
revised How to get a string between two special characters using Shell?
no reason to use the split+glob operator here.
Jun
11
asked How can we know who's at the other end of a pseudo-terminal device?
Jun
11
revised Trim last chars from a line
added 215 characters in body
Jun
11
revised Portable way to get script's absolute path?
fix exit status
Jun
11
revised Run two commands on one argument (without scripting)
added 154 characters in body
Jun
11
comment Run two commands on one argument (without scripting)
Process substitution is a ksh feature that only works in ksh (not the public domain variants), bash and zsh. Note that stat and file will run concurrently, so possibly their output will be intertwined (I suppose you're using | cat to force output buffering to limit that effect?).
Jun
11
revised Run two commands on one argument (without scripting)
typos
Jun
11
comment Run two commands on one argument (without scripting)
The !$ one won't work because !$ expands to the last word of the last history event (so of the previously entered command line, not of the stat command).
Jun
11
revised Run two commands on one argument (without scripting)
missing quotes
Jun
11
comment Run two commands on one argument (without scripting)
@1_CR, yes. stat - tells stat to do an fstat() on its fd 0.
Jun
11
revised Portable way to get script's absolute path?
`info` is a lot more usable than `man` for `zsh` manual.
Jun
11
revised Run two commands on one argument (without scripting)
added 93 characters in body