I want to put WHICH WHOAMI result into variable in c shell. I know I can make it like this in bash:
x=$(which whoami)
echo $x
But I have no idea how to achieve this in c shell. Thanks in advance
As answered previously here on Stack Overflow you may use the backtick in combination with set or setenv. As such:
set x = `which whoami` # Ordinary variable
setenv x = `which whoami` # Environment variable
Please use the search box in the top right corner of this very page next time, with a simple query like: "csh command output in variable" before posting a question.