Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options answers only user 70524

Questions on function usage in the context of Unix & Linux (mostly but not exclusively shell scripts). Questions on programming in Python, Perl, Ruby, etc. should be asked on Stack Overflow.

2
votes
It shouldn't, since you're not running zsh interactively. Quoting man zsh (section STARTUP/SHUTDOWN FILES): [I]f the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zsh …
answered Dec 30 '14 by muru
11
votes
numbers and corresponding file names for the point where the current function, sourced file, or (if EVAL_LINENO is set) eval command was called. The array is of the same length as … numbers in files, rather than relative to the start of a function, if any. funcsourcetrace This array contains the file names and line numbers of the points where the functions, sourced …
answered Jul 3 '18 by muru
0
votes
function! checkifrunning(mystring) if !system('pgrep "' . a:mystring . '"') " --do something-- endif endfunction Technically ! operates on Numbers, and converts a String to a Number …
answered Jun 23 '16 by muru
6
votes
"${@:4}" works for me in bash. You can also assign to another array and do indexing on it: foo=("$@") second_function "${foo[@]:4}"
answered Feb 8 '15 by muru
7
votes
declare -t foo sets the trace attribute on the variable foo (which has no special effect anyway). You need to use -f to set it on the function: declare -ft foo With your script modified to use -f … , I get the following output (explanation in comments): var is 0 # foo called var is 0 # before the first command in function is run var is 0 # var=1 var is 1 # var=2 var is 2 # var=3 var is 3 # trap ... …
answered Jun 11 by muru
3
votes
You're recursively calling git the function. Use command git for the internal calls so that the function isn't used for them. …
answered Mar 1 '17 by muru
2
votes
There's an environment variable called MANPAGER which can be used to make man call the command you want for displaying the manpage. The advantage of this is that you call man directly, and it won't ru …
answered Dec 12 '18 by muru
14
votes
There's also the case when there are no arguments: $ cd /tmp; cd; pwd /home/muru $ cd_func() { builtin cd "$1"; } $ cd_func /tmp; cd_func; pwd /tmp cd without any arguments changes to the home dire …
answered Oct 25 '17 by muru
3
votes
If you're not averse to using eval: $ busybox ash -c 'a()(alias x=echo\ hi;type x;alias;eval x);a' x is an alias for echo hi x='echo hi' hi I have no idea why this works.
answered Jan 23 '15 by muru