Re: Passing parmaters to a shell script
From: Stephane CHAZELAS (this.address_at_is.invalid)
Date: 05/28/04
- Next message: Ed Morton: "Re: find"
- Previous message: Rouchal Marek \(CL DAT DFA FDM\): "tcsh: complete with backreference"
- In reply to: Stu: "Passing parmaters to a shell script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 May 2004 15:28:58 +0000
2004-05-28, 07:06(-07), Stu:
> I have the following shell script:
>
> cat t.sh
> ==========
> spec="SPEC='C:\tmp\00000291.s00'"
> sh t1.sh "${spec}"
>
> that calls t1.sh
>
> cat t1.sh
> set -x
> echo "|$1|"
echo can't be use to display arbitrary data as it expands escape
sequences (here \t for tab). Moreover, it's one of the least
portable commands, some of them even accept options (you can't
display "-n" then for instance). It's a command to avoid in
scripts except to display constant strings (litterals).
Use printf instead:
printf '%s\n' "|$1|"
-- Stephane
- Next message: Ed Morton: "Re: find"
- Previous message: Rouchal Marek \(CL DAT DFA FDM\): "tcsh: complete with backreference"
- In reply to: Stu: "Passing parmaters to a shell script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|