Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Oct 2011
- STL, USA
Do trailing slashes or leading dot-slashes ever matter?
cp xxx mydir
cp xxx ./mydir/
AFAIK the only time you need the ./ is when you want to run an executable file in the current directory. ./ tells bash to look in the current directory for a command instead of looking in the path. If you want to copy to the current directory, just use the period, not the slash, as inCode:
cp xxx .
They can affect things.
sgosnell discusses the "./" prefix: it can sometimes change a bareword into a relative path, and this is used, for example:
ls # Run the standard "ls" command (probably /bin/ls) ./ls # Run a program called "ls" in the current directory bin/ls # Run a program caled "ls" in the bin/ directory ./bin/ls # Same as above
[alex@niamh ~]$ ls -l test_symlink # List the symlink itself lrwxrwxrwx 1 alex users 4 Oct 23 23:45 test_symlink -> test [alex@niamh ~]$ ls -l test_symlink/ # List the contents of the link target dir total 12 drwxr-xr-x 2 alex users 4096 Oct 22 10:45 c drwxr-xr-x 2 alex users 4096 Oct 22 10:45 perl drwxr-xr-x 2 alex users 4096 Oct 22 10:45 ruby