Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
5
votes
3
answers
1571
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-completing leaves me with and adjust its output accordingly. Is there any reason why it doesn't?
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-completing leaves me with and adjust its output accordingly. Is there any reason why it doesn't?
Bobby Jack
(349 rep)
Nov 1, 2016, 11:36 PM
• Last activity: Feb 25, 2025, 01:34 PM
1
votes
2
answers
1580
views
What is a "path name component"?
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 & Linux literature. > **My understanding so far** > > A *directory* file or an *archive* file for th...
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 & Linux literature.
> **My understanding so far**
>
> A *directory* file or an *archive* file for that
> matter are both *aggregated files* ("container files"), which can
> contain one file or two or more files, in *depth* 1 and possibly in
> deeper depths as well.
>
> Any possible file (say, an aggregated file
> or its sub-directory or its sub-archive or even its
> sub-file of whatever other kind) can have either of these path name-component *kinds*:
>
> * Singular (forwardslash**less**)
> * Plural: Two sub-path-components separated by one forward slash or three or more sub-path-components separated by two or more forward slashes
>
> If a file has a *singular* or *plural*, or not, path name component,
> is relatively depends on depth.
What is a "path name component"?
user149572
Mar 30, 2020, 02:11 PM
• Last activity: Sep 29, 2024, 08:54 AM
2
votes
5
answers
429
views
How to remove duplicate slashes from path to a file?
I have a path to a file that has duplicate slashes which would like to simplify. For example, if I have the following: ``` /opt//bin//executable ``` I would like to get: ``` /opt/bin/executable ```
I have a path to a file that has duplicate slashes which would like to simplify.
For example, if I have the following:
/opt//bin//executable
I would like to get:
/opt/bin/executable
Thesevs SCUTULATUS
(23 rep)
May 21, 2024, 08:43 PM
• Last activity: Jun 20, 2024, 07:56 PM
-2
votes
1
answers
137
views
Behavior of truncating multiple slashes in paths stemming from glob pattern matching
From my limited research it seems that in bash, any multiple slashes after a glob pattern are truncated, like so: ```sh echo ////[h]ome////user////Desktop////test//// # outputs ////home/user/Desktop/test/ echo ////home////user////Desktop////tes[t]//// # outputs ////home////user////Desktop////test/ `...
From my limited research it seems that in bash, any multiple slashes after a glob pattern are truncated, like so:
echo ////[h]ome////user////Desktop////test////
# outputs ////home/user/Desktop/test/
echo ////home////user////Desktop////tes[t]////
# outputs ////home////user////Desktop////test/
Is this conclusion correct? **Is this behavior defined?** If so, where? Is it shared between different shells? Does it have any relevance?
I've read the bash manual and couldn't find anything about this, though I might've missed something. I understand there is no semantic difference between these notations (other than the exception of a leading double slash), just not whether this behavior is intended or purposeful.
Edit: The behavior described is happening in default bash on Ubuntu. Korn shell (/usr/bin/sh
) did not truncate any slashes.
Edit 2: Just to clarify:
- I'm not asking how Linux handles multiple slashes, it's clear that multiple slashes other than the leading double slash exception have no semantic meaning and may be truncated.
- I'm not asking how this behavior impacts anything within the shell pipeline - it clearly doesn't, other than that if the glob expansion is passed down as an argument, it simply has more slashes.
- I'm not asking why this happens to paths with glob patterns - it's clear that whatever piece of code handles glob expansion also truncates the slashes that follow the glob.
- I'm specifically asking **whether this behavior is defined**, shared across different shells, intentional or purposeful.
GhtGhoster
(23 rep)
Apr 24, 2024, 06:07 PM
• Last activity: Apr 25, 2024, 04:29 PM
3
votes
1
answers
715
views
cp, trailing slash, and copying to the same vs. to another directory
To copy a directory to another directory, the first directory should be written without the trailing slash: ``` # example 1 # this command will copy dir1 to dir2 # (dir2 is preexisting) cp -Rip dir1 dir2/ ``` Otherwise, the command will copy directory contents and not the directory itself: ``` # exa...
To copy a directory to another directory, the first directory should be written without the trailing slash:
# example 1
# this command will copy dir1 to dir2
# (dir2 is preexisting)
cp -Rip dir1 dir2/
Otherwise, the command will copy directory contents and not the directory itself:
# example 2
# this command will copy dir1 contents to dir2
# (dir2 is preexisting)
cp -Rip dir1/ dir2/
I do understand the difference between dir1
and dir1/
here, and the difference between how these two commands behave doesn't confuse me.
But to copy the directory not to another directory but to the same directory where it is currently located, the trailing slash won't make any difference. Why?
# example 3
# any of these commands will make a dir1 copy
# (dir1-copy isn't preexisting)
cp -Rip dir1 dir1-copy/
cp -Rip dir1/ dir1-copy/
And another, closely related question. Why there is no difference between how mv dir1/ dir2/
and mv dir1 dir2/
work? In other words, why, in respect of trailing slash in the end of the source directory, mv
follows the logic of the third cp
example, and not the logic of examples one and two?
macOS 14.3.1, zsh 5.9 (x86_64-apple-darwin23.0)
jsx97
(1347 rep)
Mar 10, 2024, 06:25 PM
• Last activity: Mar 14, 2024, 11:38 PM
1
votes
3
answers
367
views
awk print between lines when "/" is part of the name
I need to print lines between those that contain a "/" in the name. I tried with: ``` awk '/+SOLUTION/ESTIMATES/,/-SOLUTION/ESTIMATES/' $F > fil$F ``` and ``` awk '/+SOLUTION"/"ESTIMATES/,/-SOLUTION"/"ESTIMATES/' $F > fil$F ``` and ``` awk '/"{+SOLUTION/ESTIMATES}"/,/"{-SOLUTION/ESTIMATES}"/' $F > f...
I need to print lines between those that contain a "/" in the name.
I tried with:
awk '/+SOLUTION/ESTIMATES/,/-SOLUTION/ESTIMATES/' $F > fil$F
and
awk '/+SOLUTION"/"ESTIMATES/,/-SOLUTION"/"ESTIMATES/' $F > fil$F
and
awk '/"{+SOLUTION/ESTIMATES}"/,/"{-SOLUTION/ESTIMATES}"/' $F > fil$F
but the error is always more or less the same like "unterminated string".
How can I print lines between those patterns?
euge1780
(23 rep)
Nov 25, 2023, 04:42 PM
• Last activity: Nov 26, 2023, 06:37 PM
72
votes
1
answers
64921
views
What do double slashes mean in UNIX path? Is `cd dir/subdir//` valid?
> **Possible Duplicate:** > [How linux handles multiple path separators (/home////username///file)](https://unix.stackexchange.com/questions/1910/how-linux-handles-multiple-path-separators-home-username-file) Do `cd dir/subdir/` and `cd dir/subdir//` mean the same thing in UNIX? Will the latter work...
> **Possible Duplicate:**
> [How linux handles multiple path separators (/home////username///file)](https://unix.stackexchange.com/questions/1910/how-linux-handles-multiple-path-separators-home-username-file)
Do
cd dir/subdir/
and cd dir/subdir//
mean the same thing in UNIX?
Will the latter work out? Does the difference have any special meaning for cd
, mv
, ls
, or for any other command, for that matter?
San
(937 rep)
Apr 25, 2011, 09:16 AM
• Last activity: Mar 27, 2023, 11:13 AM
0
votes
2
answers
273
views
Effect of slash (/) suffixes on symlink names for `ls` with the `-F` option
By way of example, I have a directory structure like this: $ \ls -F dir/ lnk@ $ \ls -F dir FILE $ \ls -l lnk lrwxrwxrwx 1 user group d Mon hh:mm lnk -> dir My `ls` command is aliased. I am using `\ls` to get standard behavior (I think). The question is When using the `-F` option with `ls`, why does...
By way of example, I have a directory structure like this:
$ \ls -F
dir/ lnk@
$ \ls -F dir
FILE
$ \ls -l lnk
lrwxrwxrwx 1 user group d Mon hh:mm lnk -> dir
My
ls
command is aliased. I am using \ls
to get standard behavior (I think).
The question is
When using the-F
option with ls
, why does appending a slash to the symlink name affect the behavior of ls
?
$ \ls -F lnk
lnk@
\ls -F lnk/
FILE
Without the /
, the symlink itself is listed with an @
indicator/flag/classifier; with the /
, the files in the directory that the symlink references are listed with indicators (FILE
is a regular file).
I'm not sure whether to call the behavior with no options consistent or inconsistent:
$ \ls lnk
FILE
\ls lnk/
FILE
I am not finding an explanation for this in man ls
.
Similar Posts
-------------
https://unix.stackexchange.com/questions/425029/using-ls-command-with-symbolic-links
https://unix.stackexchange.com/questions/315461/show-contents-of-symbolic-link
References
----------
https://unix.stackexchange.com/questions/29769/trailing-slashes-on-symbolic-links-to-directories
The IEEE and the Open Group (2004) "Pathname Resolution" [subsection 4.11](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11) in _The Open Group Base Specifications Issue 6_
The IEEE and the Open Group (2018a) "Pathname Resolution" [subsection 4.13](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html) in _The Open Group Base Specifications Issue 7_
The IEEE and the Open Group (2018b) "[ls](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html) "
Ana Nimbus
(687 rep)
Oct 19, 2022, 06:18 PM
• Last activity: Oct 20, 2022, 05:55 PM
2
votes
1
answers
317
views
/bin/sort appears to ignore forward slashes in its input
I'm running Ubuntu 20.0.4. Consider these contents of the following file (suppose the file is named `input`) ... /zzzzz foo bar /hij zzz xyz abc /abc ijk lmnop qwer tyuiop abc def If I run `/bin/sort input`, I get the following output ... /abc abc def /hij zzz ijk lmnop qwer tyuiop xyz abc /zzzzz fo...
I'm running Ubuntu 20.0.4.
Consider these contents of the following file (suppose the file is named
input
) ...
/zzzzz foo bar
/hij zzz
xyz abc
/abc
ijk lmnop
qwer tyuiop
abc def
If I run /bin/sort input
, I get the following output ...
/abc
abc def
/hij zzz
ijk lmnop
qwer tyuiop
xyz abc
/zzzzz foo bar
As you can see, the leading forward slash is totally ignored by the sort algorithm. There is nothing in the sort
man page which says anything about forward slashes being treated in any kind of special way.
But if I replace each of the forward slashes with the $
character, this behavior does not occur. For example, suppose that a file which is named newinput
contains these values ...
$zzzzz foo bar
$hij zzz
xyz abc
$abc
ijk lmnop
qwer tyuiop
abc def
In other words, newinput
is the same as input
, except for the fact that /
characters have been changed to $
characters. When I do /bin/sort newinput
, I get these results ...
$abc
$hij zzz
$zzzzz foo bar
abc def
ijk lmnop
qwer tyuiop
xyz abc
As you can see, in this case, the $
is indeed treated as a normal, sortable character by /bin/sort
.
So, what's going on here? And how do I cause /bin/sort
to pay attention to the /
character?
Thank you in advance for any ideas and suggestions.
**UPDATE**: If I do this under Debian, the sort works properly, both with regard to /
and $
.
So, I'm wondering if this behavior might be a "feature" of Ubuntu.
HippoMan
(737 rep)
Sep 26, 2022, 12:36 AM
• Last activity: Sep 26, 2022, 01:07 AM
127
votes
9
answers
12497
views
On what systems is //foo/bar different from /foo/bar?
Throughout the POSIX specification, there's provision ([1](http://pubs.opengroup.org/onlinepubs/9699919799.2013edition/basedefs/V1_chap03.html#tag_03_267), [2](http://pubs.opengroup.org/onlinepubs/9699919799.2013edition/basedefs/V1_chap04.html#tag_04_12), [3](http://pubs.opengroup.org/onlinepubs/969...
Throughout the POSIX specification, there's provision ((http://pubs.opengroup.org/onlinepubs/9699919799.2013edition/basedefs/V1_chap03.html#tag_03_267) , (http://pubs.opengroup.org/onlinepubs/9699919799.2013edition/basedefs/V1_chap04.html#tag_04_12) , (http://pubs.opengroup.org/onlinepubs/9699919799.2013edition/utilities/dirname.html)...) to allow implementations to treat a path starting with two
/
specially.
A POSIX application (an application written to the POSIX specification to be portable to all POSIX compliant systems) cannot assume that //foo/bar
is the same as /foo/bar
(though they can assume that ///foo/bar
is the same as /foo/bar
).
Now what are those POSIX systems (historical and still maintained) that treat //foo
specially? I believed (I've now [been proven wrong](http://thread.gmane.org/gmane.comp.standards.posix.austin.general/11947/focus=11965)) that POSIX provision was pushed by Microsoft for their Unix variant (XENIX) and possibly Windows POSIX layer (can anyone confirm that?).
It is used by Cygwin which also is a POSIX-like layer for Microsoft Windows. Are there any non-Microsoft Windows systems? OpenVMS?
On systems where //foo/bar
is special, what is it used for? //host/path
for network file systems access? Virtual file systems?
Do some _applications_ running on Unix-likes —if not the system's API— treat //foo/bar
paths specially (in contexts where they otherwise treat /foo/bar
as the path on the filesystem)?
---
**Edit**, I've since [asked a question on the austin-group mailing list](http://thread.gmane.org/gmane.comp.standards.posix.austin.general/11947) about the origin of //foo/bar
handling in the spec, and the discussion is an interesting read (from an archaeology point of view at least).
Stéphane Chazelas
(579282 rep)
Jan 20, 2016, 10:20 AM
• Last activity: Jun 27, 2022, 07:07 PM
23
votes
3
answers
3734
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): > **Exercise 3-6.** (Trick question) How do you get a / into a filename (i.e., a / that doesn't sepa...
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):
> **Exercise 3-6.** (Trick question) How do you get a / into a filename (i.e., a / that doesn't separate components of the path?
I'be been working with Linux for years, both as end-user and programmer, but I cannot answer this question. There is *no way* to put slashes in filenames, it's absolutely forbidden by the kernel. You can patch your filesystem via block device access, or use similarly-looking characters from the Unicode, but those aren't solutions.
I understand that Linux ≠ Unix, but the same principle should apply, since the system has to be able to unambiguously extract directory hierarchy from paths.
Does somebody know, what exactly Kernighan and Pike thought about when asking this questions? What was the supposed answer? What exactly is the 'trick'? Or maybe original Unix system simply allowed to escape this slash somehow?
**UPD:**
I contacted Brian Kernighan about the question and that's what he replied:
> The answer is (or was) “You can't.”
Hence, Timothy Martin was right and gets the green tick.
firegurafiku
(473 rep)
Apr 18, 2017, 11:24 PM
• Last activity: Feb 17, 2022, 09:15 PM
18
votes
3
answers
7727
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` would - move `dira` into `dirb` (it will become `dirb/dira`) Noting that in both case...
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
would
- move dira
into dirb
(it will become dirb/dira
)
Noting that in both cases there are no notice or message, then this is pretty inconsistent to me. I think mv dira dirb
should just overwrite dirb
with the contents of dira
(or merge the two directories under a directory named dirb
).
I remember reading somewhere that a directory name with a slash (like dira/
) is treated like a directory, and name with no slash (like dira
) is treated like a file (to certain extents, of course). Anyway now I want to make the shell (zsh and possibly bash) respect my notation of a directory by using a slash. Is there a terminal option which enable me to enforce that?
To clarify, here is my desired behaviour:
- mv dira dirb
results in dirb
being overwritten with the contents of dira
- mv dira dirb/
results in dira
being moved into dirb
(in dirb/dira
)
Has anyone thought the same way as me? Or am I just weird?
phunehehe
(20536 rep)
Aug 20, 2010, 09:53 AM
• Last activity: Aug 22, 2021, 02:32 PM
4
votes
1
answers
19606
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, thats why I want to creat it! :-/ #!/bin/bash #remove previous day's dump and create new rm -f /hom...
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, thats why I want to creat it! :-/
#!/bin/bash
#remove previous day's dump and create new
rm -f /home/user/db_dump_*.txt;
pg_dumpall -U postgres -w > /home/user/db_dump_
date '+%d/%m/%Y_%H:%M:%S'
.txt;
The result is:
db_dump.sh: line 4: /home/user/db_dump_12/02/2017_14:30:15.txt: No such file or directory
The date command is working fine and the filename comes out perfect but instead of the file being created, I get the error saying that it doesn't exist. I'm running the script as root so there should be no issues with permissions. I can write to the user's home directory without any problems.
Any ideas?
rijo79
(75 rep)
Feb 12, 2017, 08:15 PM
• Last activity: Mar 14, 2021, 09:12 PM
152
votes
6
answers
30921
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 double '`/` in the path. I know that bash doesn't care if you have multiple file separators, but I'm won...
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 double '
/
in the path. I know that bash doesn't care if you have multiple file separators, but I'm wondering how exactly that is rectified. Is it bash that strips extra /
s or does it really not matter ever?
I ask because it will save me several lines of code to check for extra /
s while concatenating. I know it's not a big deal, but I'm curious as well. I have a bash script that has the line cd //usr
(instead of cd /usr
), which seems to imply there might be a significance to using multiple /
s in a path
Falmarri
(13507 rep)
Sep 12, 2010, 08:59 AM
• Last activity: Oct 5, 2020, 07:43 AM
0
votes
3
answers
906
views
How to pass a string containing slashes to sed without treating it as a file? (No such directory or file)
I need to pass a string containing slashes to sed to extract some values from it, but when I try to do so it treats it as a directory/file and throws a "No such directory or file" error instead. I'm assuming this is because it reads it as a path and tries to find the file when it is not the intended...
I need to pass a string containing slashes to sed to extract some values from it, but when I try to do so it treats it as a directory/file and throws a "No such directory or file" error instead. I'm assuming this is because it reads it as a path and tries to find the file when it is not the intended effect. Example:
my_value="my/value"
operand="$($my_value | sed -n -e 's/^\(.*\)\/.*/\1/p')"
# Expected echo $operand : my
Note: I am new to bash scripts so this could be the wrong way to go about this
DMX David Cardinal
(103 rep)
May 11, 2020, 10:48 PM
• Last activity: May 12, 2020, 05:54 AM
11
votes
4
answers
1403
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 "directories" only, while `*` means "all files and directories", but for some reason, many users seem t...
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 "directories" only, while *
means "all files and directories", but for some reason, many users seem to not know it, and books don't mention it either.
Is there a definitive source that talks about what */
means and perhaps its variations?
nonopolarity
(3289 rep)
Mar 28, 2020, 08:33 PM
• Last activity: Mar 31, 2020, 02:43 AM
6
votes
1
answers
659
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.csv file.$(printf "%q" $(date +%D)).csv But it still fails.
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.csv file.$(printf "%q" $(date +%D)).csv
But it still fails.
tres.14159
(249 rep)
Mar 27, 2019, 05:27 PM
• Last activity: Mar 28, 2019, 04:52 PM
2
votes
4
answers
2833
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 run, for example, the command `./home/yogesh/Desktop/Books`, I get this error: bash: ./home/yogesh/D...
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 run, for example, the command ./home/yogesh/Desktop/Books
, I get this error:
bash: ./home/yogesh/Desktop : No such file or directory
However, on removing the dot it gives
/home/yogesh/Desktop/Books : Is a directory
Or, if I run /Desktop
, it returns
/Desktop : No such file or directory
But on adding a dot before /
, I get
./Desktop: is a directory
What is the difference between ./
and /
?
Yogesh Tripathi
(171 rep)
May 16, 2015, 07:48 AM
• Last activity: Feb 21, 2019, 02:00 PM
3
votes
1
answers
2667
views
What does the slash do in 'case $1/$2' in shell script (/bin/sh)
Found [this][1] 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 operator or something else. [1]: https://wiki.archlinux.org/index.php/Power_management#Hooks_in_/usr/lib/systemd/system-sl...
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 operator or something else.
James Langham
(33 rep)
Dec 22, 2018, 04:22 PM
• Last activity: Dec 22, 2018, 05:45 PM
2
votes
1
answers
3524
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 the loop. cd "$wDir" for client in */; do cd "$wDir"/"$client"; #-- check to see if any .csv files...
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 the loop.
cd "$wDir"
for client in */; do
cd "$wDir"/"$client";
#-- check to see if any .csv files exists
if ls *.csv &>/dev/null; then
for csvfile in *.csv; do
if test $(find "$csvfile" -mmin +2880); then
echo "$client has files older than 2 days ..." >> "staleFtpAccts"
fi
done
fi
done
When I execute the script, a / is placed after the $client variable like so:
root@me /home/frank # bash script.sh
Start ...
000029_000020/ has files older than 2 days ...
#--
Finished ...
Start ...
000033_000040/ has files older than 2 days ...
#--
Finished ...
Start ...
000033_000041/ has files older than 2 days ...
#--
Finished ...
Start ...
000033_000042/ has files older than 2 days ...
#--
Finished ...
Start ...
000033_000043/ has files older than 2 days ...
#--
Finished ...
This is the result I am after ...
root@me /home/frank # bash script.sh
Start ...
000029_000020 has files older than 2 days ...
#--
Finished ...
Start ...
000033_000040 has files older than 2 days ...
#--
Finished ...
Start ...
000033_000041 has files older than 2 days ...
#--
Finished ...
Start ...
000033_000042 has files older than 2 days ...
#--
Finished ...
Start ...
000033_000043 has files older than 2 days ...
#--
Finished ...
Vituvo
(411 rep)
Mar 23, 2018, 02:50 PM
• Last activity: Mar 23, 2018, 04:20 PM
Showing page 1 of 20 total questions