1

Linux Bash Script: How to get absolute path to file

view story
linux-howto

http://stackoverflow.com – I am trying to write a very very simple script in Linux. Let me show you the code first: #!/bin/bash # The shell program uses glob constructs and ls # to list all entries in testfiles, that have 2 # or more dots "." in their name. ls -l /path/to/file/*.*.* When I run this code with bash myscript command, I get something like: /path/to/file/file.with.three.dots But I don't want this. I want to show only the file name, not the path. Then I tried: ls -l *.*.* But this time is shows me the files, only if I am inside the /path/to/file/. How can I set the path, so when running the script (HowTos)