|
Prev: Tilde home directory variable name expansion problem
Next: Killing process with more than one day
From: Thomas Kreuzer on 19 Jun 2008 13:48 Hejhej, I am trying to rewrite a /bash/ script to be POSIX compilant, so it will work with /dash/. In this script there is a function call lile this: getmounts >$TMPSRC #getmounts is the function obviously in /dash/ it never actually calls that function, and just drops out of the script. Now I am not really sure, but I think in /bash/ it translates to redirecting the return value of the funtion into the variable TMPSCR, how would I achieve this while staying POSIX compilant? Thanks in advance, Thomas
From: Stephane CHAZELAS on 19 Jun 2008 14:05 2008-06-19, 19:48(+02), Thomas Kreuzer: > I am trying to rewrite a /bash/ script to be POSIX compilant, so it will > work with /dash/. > In this script there is a function call lile this: > > getmounts >$TMPSRC #getmounts is the function obviously > > in /dash/ it never actually calls that function, and just drops out of the > script. > Now I am not really sure, but I think in /bash/ it translates to > redirecting the return value of the > funtion into the variable TMPSCR, how would I achieve this while staying > POSIX compilant? [...] The above happens to be POSIX and *not* bash. It redirects the standard output of getmounts to the file whose name is contained in the $TMPSRC variable. In bash (when bash is not called as "sh"), you need the quotes around $TMPSRC: getmounts > "$TMPSRC" which also is standard POSIX syntax of course. What makes you think it doesn't work in dash? -- St�phane
From: Thomas Kreuzer on 19 Jun 2008 14:25 On Thu, 19 Jun 2008 20:05:33 +0200, Stephane CHAZELAS <stephane_chazelas(a)yahoo.fr> wrote: > 2008-06-19, 19:48(+02), Thomas Kreuzer: >> I am trying to rewrite a /bash/ script to be POSIX compilant, so it will >> work with /dash/. >> In this script there is a function call lile this: >> >> getmounts >$TMPSRC #getmounts is the function obviously >> >> in /dash/ it never actually calls that function, and just drops out of >> the >> script. >> Now I am not really sure, but I think in /bash/ it translates to >> redirecting the return value of the >> funtion into the variable TMPSCR, how would I achieve this while staying >> POSIX compilant? > [...] > > The above happens to be POSIX and *not* bash. > > It redirects the standard output of getmounts to the file whose > name is contained in the $TMPSRC variable. > > In bash (when bash is not called as "sh"), you need the quotes > around $TMPSRC: > > getmounts > "$TMPSRC" > > which also is standard POSIX syntax of course. > > What makes you think it doesn't work in dash? > Duh, actually you are right, it does work. Then I have to keep searching for the actual error :( Thank you very much though, Thomas
|
Pages: 1 Prev: Tilde home directory variable name expansion problem Next: Killing process with more than one day |