I would like to store the path of a file typed by the user in a variable and then use it
Asked
Active
Viewed 54 times
2 Answers
-1
Use dirname
to get just path for any "file".
Example:
$ read -p "Please type file full path: " myVar
Please type file full path: /tmp/bla/bla/file
$ dirname "${myVar}"
/tmp/bla/bla

Azize
- 4,006
- 2
- 22
- 38