Bash Scripting Problem

Luciano Rocha strange at nsk.no-ip.org
Tue May 20 17:42:38 UTC 2008


On Tue, May 20, 2008 at 07:31:16PM +0200, Thomas Kappelmueller wrote:
>  Hello!
> 
>  I hope this place is ok to ask this question.
>  I am using Fedora 8.
> 
>  Example:
>  #!/bin/bash
> 
>  COMMAND='ls "test dir 1"'
> 
>  $COMMAND #have tried $($COMMAND), '$COMMAND'
> 
>  It always cuts it in half at the spaces.

$ eval $COMMAND
ls: cannot access test dir 1: No such file or directory

Though I recommend other ways. Like using functions
f() { ls "test dir 1"; }
COMMAND=f
$COMMAND

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080520/0e7b00ce/attachment-0001.sig>


More information about the fedora-list mailing list