1830899 Members
1905 Online
110017 Solutions
New Discussion

Csh shell

 
SOLVED
Go to solution
Carme Torca
Super Advisor

Csh shell

Hello,

I'm trying to put the value of a command to a variable, but I don't know how to make it.

In Ksh shell I do: var=$(date), but at the csh shell: set var=$(date), it's wrong....

Could anyone help me???
Users are not too bad ;-)
3 REPLIES 3
Vincenzo Restuccia
Honored Contributor

Re: Csh shell

set
set name=word
set name[index]=word
set name=(wordlist)
The first form of set shows the value of all shell
variables. Variables whose value is other than a single
word print as a parenthesized word list. The second form
sets name to the null string. The third form sets name to
the single word. The fourth form sets the indexth component
of name to word; this component must already exist. The
final form sets name to the list of words in wordlist. In
all cases the value is command and file-name expanded.

These arguments can be repeated to set multiple values in a
single set command. Note, however, that variable expansion
happens for all arguments before any setting occurs
Graham Forecast
New Member
Solution

Re: Csh shell

Hi Carme,

try set var=`date`
Stefan Schulz
Honored Contributor

Re: Csh shell

Hi,

it is pretty simple. You have to include the command in single backticks. Like in the following example. Note the different single quotes.

set datum = `date +'%Y-%m-%d %H:%M'`

Hope this helps. Stefan
No Mouse found. System halted. Press Mousebutton to continue.