a "script-relative" version of env

2011-05-27 Thread E R
Hi all, This is not a bash bug, but I am hoping the people on this list would find the question interesting... I have found it useful to have a "script-relative" version of /usr/bin/env. Whereas env determines an interpreter's location based on PATH, this version would determine the interpreter's

difference between ${1+"$@"} and "$@"?

2010-08-26 Thread E R
With bash is there any difference between the expressions ${1+"$@"} and "$@"? Is there any difference with other sh-like shells? Thanks, ER

setting a variable from a function called from PS1

2010-08-25 Thread E R
I've been trying to get a function called from PS1 to set a variable, e.g.: num=1 function xyz { ((num++)) date; echo "num: $num" } PS1="\$(xyz): " In this example, the global value of num doesn't change if it is called from PS1. However num does get incremented if xyz is called directly. Is