I am trying to do the following task :
export ENV=aaa
export ENV_PATH=$(cd /apps | ls | grep $ENV)
However, it's not working. What's the way to change to directory and search some file in that directory in single command
Please help.
I am trying to do the following task :
export ENV=aaa
export ENV_PATH=$(cd /apps | ls | grep $ENV)
However, it's not working. What's the way to change to directory and search some file in that directory in single command
Please help.
Try replacing the first pipe by a semicolon.
... or better replace it by && (two ampersand = logical "and"; only continue with the "ls | grep ..." if the "cd ..." was succesful).