Executing command in Shell

From: Paulie (pstuyv-no-to-spam_at_yahoo.co.uk)
Date: 05/31/05


Date: Tue, 31 May 2005 17:34:08 +0100

I am familiar with languages such as REXX and C and am trying to bring
myself up to speed with simple scripts in Unix. I would like the ability to
execute an existing command such as date and get the various parts of it
into variables in a script. I have found various examples in manuals and on
the net and none of them seem to work for me, so any hints appreciated. I
have tried these in both BASH and ZSH

Example 1 - from Unix programming, Kernighan & Pike
set 'date'
echo $1 $2 # Just displays the word date

Example 2 - from website
today='date'
echo "today is $today" #displays today is date

The date command works fine if executed as a line on its own in a script.

TIA, Paul



Relevant Pages

  • CGIscript.net - csMailto.cgi - Remote Command Execution
    ... CGIscript.net - csMailto.cgi - Remote Command ... csMailto is a perl cgi formmail script developed by ... execute command on server and mail output to anyone ...
    (Bugtraq)
  • Re: csccmd not running in script
    ... I moved the code around a little so that csccmd runs before anything else ... and I get no echo. ... command to complete so we can retrieve the return code. ... you may need to use "Run as Administrator" when you run the script. ...
    (microsoft.public.scripting.vbscript)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.questions)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.shell)
  • =?iso-8859-1?Q?Re:_Jcl?=
    ... I can send you a program that you execute as a step in your job and it ... I have a command and job scheduler that is available in a free version ... demand script processor with the full scripting ability so that your job ...
    (bit.listserv.ibm-main)