Variables in shell script not working
Karl Auer
kauer at biplane.com.au
Sat Nov 15 14:05:56 UTC 2008
On Sat, 2008-11-15 at 14:40 +0100, Jef Driesen wrote:
> If I quote the variable, the error disappears, but the rest of my
> script does not work anymore. No output is produced on stdout.
> Echo'ing the variable works, but the script does not seem to execute
> the contents of the variable when it reaches the line
>
> $SOURCE | sed 's/foo/bar'
What happens? What output do you see, if any?
Does this script work?
X="echo fred"
$X | grep fred
It should output
fred
If that works, try this:
#!/bin/sh
X="echo fred"
$X | sed s/fred/martha/
It should output
martha
If both those work, I suspect dos2unix does not output what you think it
outputs. As far as I can tell, dos2unix outputs nothing unless it has a
problem with a conversion (it converts in place by default), so I'm a
bit puzzled about what sed is supposed to be doing.
Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au) +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/ +61-428-957160 (mob)
GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20081116/c800850e/attachment.sig>
More information about the ubuntu-users
mailing list