So first you should know that this is two commands – pwd
and sed -e "s#/survey1##"
– and these two commands are being run together in a pipeline. That is, the output of the first command is being sent to the second command as input.
That is, in general, what |
means in unix shell scripts.
So then, what do each of these commands do? pwd
stands for “print working directory” and prints the current directory (where you ran the script from, unless the script itself had any cd
commands in it).
sed
is a command that’s really a whole separate programming language that people do many simple text-processing commands with. The simple sed
program you have here – s#/survey1##
– strips the string /survey1
out of its input, and prints the result.
So the end result is that the variable PGMPATH
becomes the current directory with /survey1
stripped out of it.
1
solved What is the meaning of pwd|sed -e?