2

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.

1 Answers1

1

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.
Drav Sloan
  • 14,345
  • 4
  • 45
  • 43