Executing command in Shell
From: Paulie (pstuyv-no-to-spam_at_yahoo.co.uk)
Date: 05/31/05
- Next message: Ed Morton: "Re: Case statement"
- Previous message: Kenny McCormack: "Re: bash : how to redirect both stdout and stderr to append a file"
- Next in thread: Janis Papanagnou: "Re: Executing command in Shell"
- Reply: Janis Papanagnou: "Re: Executing command in Shell"
- Reply: Ed Morton: "Re: Executing command in Shell"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Ed Morton: "Re: Case statement"
- Previous message: Kenny McCormack: "Re: bash : how to redirect both stdout and stderr to append a file"
- Next in thread: Janis Papanagnou: "Re: Executing command in Shell"
- Reply: Janis Papanagnou: "Re: Executing command in Shell"
- Reply: Ed Morton: "Re: Executing command in Shell"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|