Bash workingdirectory use as variable -


I need some homework ... The question is: How do you print the path of the current directory (working directory) And how can you use it as a variable?

The first part of the question is easily answered: pwd

But how can I use it as a variable?

In the Bash, you can execute a command and get the output using the backticks, For example

  Paul @ Pal-laptop: ~ $ working_directoryRi = `pwd` Paul @ pal-laptop: ~ $ echo $ working_directory / home / paul  
< P> There is also an optional syntax using the dollar sign and bracket - WORKING_DIRECTORY = $ (pwd)


Comments