I want to write a start up script in tsch that creates a directory some where named with the current user id. I was hoping the following would work.

Set A = (id -u -n)

But I'm not sure how to handle the output of the command id properly for this kind of variable assignment.


You were very close, you use this instead:

set A=`id -u -n`

The ` characters tell tcsh to run the command and then set assigns the output to A. You can make that variable read only too, with:

set -r A=`id -u -n`

After doing so, attempting to override its value will give:

> set A=foo
set: $A is read-only.
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.