Questions tagged [slash]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
63 views

What is a “path name component”? [duplicate]

I am not sure I correctly understood what is a path name component (or perhaps better written; path name-component) which I understand to be commonly abbreviated simply as "component" in the Unix &...
9
votes
4answers
1k views

Where can I find a definitive answer for what `*/` means in Bash or Zsh?

I was trying to look into some reference from O'Reilly about Unix and Bash about the meaning of */ but couldn't find any. We can echo */ and see all the directories. It seems like it means all "...
6
votes
1answer
292 views

Escape a mm/dd/YY backup date in a file name

I have been trying to: cp file.csv file.$(date +%D).csv But it fails because the filenames is: file.03/27/19.csv with the slash of separate directories. And I have been trying again to: cp file....
3
votes
1answer
679 views

What does the slash do in 'case $1/$2' in shell script (/bin/sh)

Found this example on the arch wiki #!/bin/sh case $1/$2 in pre/*) echo "Going to $2..." ;; post/*) echo "Waking up from $2..." ;; esac and can't make out if it's a logical ...
1
vote
1answer
915 views

How to remove the trailing slash from a variable which defines a directory from a time test output

Ubuntu 16.04 Even thou the output of for client in */; do doesn't produce a trailing slash, the trailing slash appears if I echo the variable $client while performing a time test on the file, within ...
3
votes
3answers
856 views

How does the shell interpret ././command-name?

I have a binary file named hello2 in my current working directory. To execute it I need to press ./hello2 and it shows the output. But when I use the following command ././hello2 it still works. ...
2
votes
3answers
95 views

Is there any difference w/ v/s w/o “./” in a relative path?

Is there any subtle difference between: file and ./file as a relative path?
2
votes
2answers
240 views

Why can a softlink to a directory be created with or without the trailing slash?

I have found that when creating a symbolic link to a folder it is produced with or without the trailing slash based on your input. for example: $ ln -sfv /ln-test/FOLDER/ test-tail test-tail -> /...
0
votes
1answer
5k views

Forward slash not detected in “grep” command

I have a sql query in a text file and it has a line that looks like: PARTITION BY (date_key // 100000000); Now, I want to replace the two forward slashes with the word "DIV". For that, I did the ...
23
votes
3answers
534 views

Kernighan and Pike challenge: how to put a slash in a filename?

I've just encounter the following question in Unix Programming Environment, the Kernighan and Pike's classic book on Unix (I found the below text on p. 79 of year 1984 edition, ISBN:0-13-937699-2): ...
26
votes
3answers
2k views

How to delete a file named “filen/ame” (with slash) on an ext4 filesystem in debugfs?

Playing with e2fsprogs debugfs, by change/accident, a file named filen/ame was created. Obviously the forward slash character / serves as the special separator character in pathnames. Still using ...
2
votes
1answer
6k views

Bash script error trying to write to file: no such file or directory

I'm getting an error with a very simple script. The script should run pg_dumpall and write the output to a file but I'm getting an error that the resulting file doesn't exist. I know it doesn't exist, ...
1
vote
1answer
93 views

Any reason why find does not merge multiple slashes into one?

Is it true that find is not supposed to be doing even the most simple path unification/simplifications operations, such as coalescing multiple successive slashes together (which would be equivalent to ...
1
vote
3answers
3k views

How to create a directory with '/' in unix?

I want to create a directory with name as below A3456/90876/IN AS%90876 JI KOL
4
votes
1answer
436 views

Is it ok that find displays double forward-slash?

Is it a bug that, when I find ./path/here/ I get: ./path/here//foo ./path/here//bar I know find wants me to specify the path without the trailing slash, but surely it can detect the path that tab-...
6
votes
3answers
2k views

What does dot forward slash forward slash mean (.//)?

I was querrying a server using a command like this: find ./ -type f -name 'filename" I got many files starting with .//library or .//user What do these things mean?
1
vote
2answers
314 views

Get `scp path/` behave like `rsync path/`

I have local file structure: /tmp/24 /dir1 /file1 /file2 /dir2 /file3 /file4 and I want to upload it to remote compute. When I use rsync /tmp/24 host:/target ...
2
votes
0answers
238 views

cd with double slash hangs forever on Mac OS X Terminal

If I type cd // on the Mac OS X Terminal (Version 2.6.1 (361.1)), the prompt hangs forever. Why? Curiously that doesn't happen if I do cd / or cd ///. I am using El Captain with the bash that comes ...
2
votes
2answers
648 views

difference between /dir and /dir/ [duplicate]

Consider a symlink I am making to my Music directory named music. ln -s Music music now consider following sequence of commands: edward@ArchLinux:~$ readlink music Music edward@ArchLinux:~$ ...
116
votes
9answers
10k views

On what systems is //foo/bar different from /foo/bar?

Throughout the POSIX specification, there's provision (1, 2, 3...) to allow implementations to treat a path starting with two / specially. A POSIX application (an application written to the POSIX ...
1
vote
3answers
3k views

What is the difference between a directory name that ends with a slash and one that does not? [duplicate]

Is there any difference between a directory name such as mydirectory and mydirectory/ I noticed this happens when I execute ls in some directories - some of the directory names have a slash and ...
2
votes
4answers
2k views

Why ./home/Desktop is incorrect and ./Desktop is correct?

I'm learning about Linux, started yesterday. I have a question which I couldn't answer from my book or Google. What is the difference between ./ and / in the shell? I'm asking this because when I ...
1
vote
2answers
4k views

Why do I have double slash here?

$ which mycommand /home/t/program_files/document/other edits//mycommand Why do I have double slash // here?
1
vote
5answers
6k views

Difference between including / at the end of a directory path and and omitting it [duplicate]

I am just wondering is there a difference in what happens when I leave / at the end of a file path for example: root /var/www/website.com/ And omitting it like: root /var/www/website.com How is ...
61
votes
3answers
4k views

Shebang starting with `//`?

I'm confused about following script (hello.go). //usr/bin/env go run $0 $@ ; exit package main import "fmt" func main() { fmt.Printf("hello, world\n") } It can execute. (on MacOS X 10.9.5) $ ...
2
votes
1answer
266 views

When is a symlink treated as the thing it links to, and as a symlink?

When is a symlink treated as the thing it links to, and as a symlink? A symlink can links to a file of different types. For example, let mylk be a symlink which links to a dir. The following two ...
3
votes
1answer
567 views

Test for link with trailing slash?

I created in /tmp/test/ mkdir somedir ln -s somedir/ somelink I want to loop through only directories: for file in */ ; do if [[ -d "$file" && ! -L "$file" ]]; then echo "$file is a ...
61
votes
4answers
40k views

When should I use a trailing slash on a directory? [duplicate]

Possible Duplicate: How linux handles multiple path separators (/home////username///file) Most commands I use in linux behave exactly the same whether I include the trailing slash / character on ...
5
votes
2answers
13k views

What causes ln: //: Is a directory?

When linking a directory to root, I get this error: $ ln -s ~/inbox/ / $ ln: //: Is a directory Bash autocompletes the directory path by adding a /. I've tried escaping without success. $ ln -s ~/...
4
votes
2answers
997 views

What does '//' mean in return from `which`

I have an executable script test under the full path /home/sawa/foo/bar/test. The directory /home/sawa/foo/bar is within $PATH, and has priority over the default ones including /usr/bin. When I do `...
57
votes
4answers
16k views

unix, difference between path starting with '/' and '//' [duplicate]

In unix/linux, any number of consecutive forwardslashes in a path is generally equivalent to a single forwardslash. eg. $ cd /home/shum $ pwd /home/shum $ cd /home//shum $ pwd /home/shum $ cd /home///...
49
votes
1answer
41k views

What do double slashes mean in UNIX path? Is `cd dir/subdir//` valid? [duplicate]

Possible Duplicate: How linux handles multiple path separators (/home////username///file) Do cd dir/subdir/ and cd dir/subdir// mean the same in UNIX? Will the later work out? Else does it have ...
0
votes
1answer
769 views

Inconsistency in behavior of 'rm' when a mounted volume is involved?

If I run the following sequence of commands: mkdir dir ln -s dir link rm -r link/ I get this output: rm: cannot remove `link': Not a directory I get the warning because I could simply have issued ...
117
votes
6answers
22k views

How does Linux handle multiple consecutive path separators (/home////username///file)?

I'm working on a python script that passes file locations to an scp subprocess. That's all fine, but I'm in a situation where I may end up concatenating a path with a filename such that there's a ...
14
votes
2answers
4k views

the slash (/) after a directory name on shell commands

I have a little question here. If I have two files, say filea and fileb, mv filea fileb would delete fileb rename filea to fileb Then if I have two directories, say dira and dirb, mv dira dirb ...