[HPADM] Run command set in a variable

From: Edi CAHYADI (edi.cahyadi@st.com)
Date: Tue Aug 29 2006 - 00:52:44 EDT


Hi All,

We can set a command in a variable, for example:
# cmd=mount
Or
# cmd="ps -ef | grep root"
And
Run it:
# $cmd

But don’t know why the following variable setting has error when run:
# cmd="mount | grep /app"
# $cmd
usage: mount [-l][-v|-p]
        mount [-F FStype][-eQ] -a
        mount [-F FStype][-eQrV][-o specific_options]
                { special | directory }
        mount [-F FStype][-eQrV][-o specific_options]
                special directory

# cmd="for x in 1 2 3; do echo $x; done"
# $cmd
sh: for: not found.

Can anybody help?

Regards,
Edi

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:54 EDT