Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (6.1k points)

During my research on this, I found the following code on the .sh file of my project to define some path :

PGMPATH=`pwd|sed -e "s#/survey1##" `

What is the meaning of the above line? Reference of PGMPATH is used as below :

LIBS="${LIBS}:${PGMPATH}/edmz-par-api_1.4.jar"

LIBS="${LIBS}:${PGMPATH}/commons-logging.jar"

Kindly tell me how it works as I do not have any clue about this.

1 Answer

0 votes
by (11.7k points)

Linux is the best open-source platform to almost experiment with everything using various commands available.

Here, in your query, these are two commands =pwd and sed -e “s#/survey1##” = and we use these commands together in the pipeline. This means that the input of the second command will be the output of the first command. 

The acronym of pwd is Print Working Directory and prints the current directory. 

sed command is actually a completely different programming language with which many simple text-processing commands are done. 

This is the simple sed program here - s#/survey1## - strips the string /survey1 out of its input, and prints the result.

Therefore the end result is that the variable PGMPATH becomes the current directory with /survey1 stripped out of it.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 23, 2021 in Java by rahulnayar01123 (6.1k points)

Browse Categories

...