Bash Guru?

Forum rules
Before you post please read this

Bash Guru?

Postby Tejas_0 on Tue Mar 18, 2014 9:21 am

Help appreciated in deciphering output from simple command line gone awry:
Code: Select all
cp p10/tmp/ffM_0/contentblock-whitelist-regex.txt p1/kix/hse/ffM_0
Output of command:
Code: Select all
mint@mint ~ $ cp p10/tmp/ffM_0/contentblock-whitelist-regex.txt p1/kix/hse/ffM_0
ffM_0/         ffM_0_bak.xpi  ffM_0_ext/     ffM_0_ext_bak/ ffM_0.xpi
mint@mint ~ $ cp p10/tmp/ffM_0/contentblock-whitelist-regex.txt p1/kix/hse/ffM_0
Second command line was output by Bash.

Directory sizes seem to check out OK:
Code: Select all
mint@mint ~ $ du -sh p1/kix/hse/ffM_0
38M   p1/kix/hse/ffM_0
mint@mint ~ $ du -sh p1/kix/hse/ffM_0_ext
28M   p1/kix/hse/ffM_0_ext
mint@mint ~ $ du -sh p1/kix/hse/ffM_0_ext_bak
39M   p1/kix/hse/ffM_0_ext_bak

Intended file copy seems to have worked:
Code: Select all
mint@mint ~ $ find p1/kix/hse -name contentblock-whitelist-regex.txt
p1/kix/hse/ffM_0/contentblock-whitelist-regex.txt
p1/kix/hse/ffM_0_ext_bak/contentblock-whitelist-regex.txt
p1/kix/hse/ffM_0_ext/contentblock-whitelist-regex.txt

mint@mint ~ $ ls -l p1/kix/hse/ffM_0/contentblock-whitelist-regex.txt
-rw-r--r-- 1 mint mint 910 Mar 18 12:48 p1/kix/hse/ffM_0/contentblock-whitelist-regex.txt
mint@mint ~ $ ls -l p1/kix/hse/ffM_0_ext_bak/contentblock-whitelist-regex.txt
-rw-r--r-- 1 mint mint 614 Nov 30 14:54 p1/kix/hse/ffM_0_ext_bak/contentblock-whitelist-regex.txt
mint@mint ~ $ ls -l p1/kix/hse/ffM_0_ext/contentblock-whitelist-regex.txt
-rw-r--r-- 1 mint mint 778 Mar 10 20:13 p1/kix/hse/ffM_0_ext/contentblock-whitelist-regex.txt

The .xpi files have remained as such and check out
Code: Select all
mint@mint ~ $ find p1/kix/hse -name ffM_0.xpi
p1/kix/hse/ffM_0.xpi
mint@mint ~ $ find p1/kix/hse -name ffM_0_bak.xpi
p1/kix/hse/ffM_0_bak.xpi
mint@mint ~ $ ls -sh p1/kix/hse/ffM_0.xpi
6.9M p1/kix/hse/ffM_0.xpi
mint@mint ~ $ ls -sh p1/kix/hse/ffM_0_bak.xpi
6.8M p1/kix/hse/ffM_0_bak.xpi
And there is nothing in $HOME, so far unable to find out what has been corrupted. :(
Last edited by Pilosopong Tasyo on Tue Mar 18, 2014 10:29 pm, edited 1 time in total.
Reason: Moved from Software & Applications
Release: Linux Mint 16 "petra"
Edition: Cinnamon 32-bit
Linux mint 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:12:00 UTC 2013 i686 athlon i686 GNU/Linux
Tejas_0
Level 3
Level 3
 
Posts: 187
Joined: Tue May 17, 2011 6:06 pm

Linux Mint is funded by ads and donations.
 

Re: Bash Guru?

Postby karlchen on Tue Mar 18, 2014 9:42 am

Hello, Tejas_0.

In the initial command the target folder of the copy operation is p1/kix/hse/ffM_0
The parent folder of the target folder is p1/kix/hse.
This parent folder holds the subfolders ffM_0/, ffM_0_ext/ and ffM_0_ext_bak/ and the files ffM_0_bak.xpi and ffM_0.xpi

Could it be that at the end of your first cp commandline you accidently pressed the <tab> key before actually pressing the <enter< key?
Pressing the <tab> key would have invoked automatic name completion. This means bash would have listed all names beginning with ffM_0 that are located in the folder p1/kix/hse.

This seems to be what has happened.

Kind regards,
Karl
Image
Endless legions of bigoted, brutal, bloodthirsty Orcs from the dark land of Mordor are bringing desolation, despair and death to the poor inhabitants of the Middle East. [1]
User avatar
karlchen
Level 10
Level 10
 
Posts: 3109
Joined: Sat Dec 31, 2011 7:21 am

Re: Bash Guru?

Postby Tejas_0 on Tue Mar 18, 2014 10:22 am

Thanks very much Karlchen :o No, copied command from Gedit file that was open. Line in file was a bit funny, in that it line wrapped prematurely. Had then copied line to scratch file and dumped the file. Command line ended with \t \t \n.
Release: Linux Mint 16 "petra"
Edition: Cinnamon 32-bit
Linux mint 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:12:00 UTC 2013 i686 athlon i686 GNU/Linux
Tejas_0
Level 3
Level 3
 
Posts: 187
Joined: Tue May 17, 2011 6:06 pm

Re: Bash Guru?

Postby karlchen on Tue Mar 18, 2014 10:42 am

Hello, Tejas_0.

\t \t \n, this is <tab> <tab> <enter> - And as stated before <tab> will invoke the bash filename/foldername completion.

Karl
Image
Endless legions of bigoted, brutal, bloodthirsty Orcs from the dark land of Mordor are bringing desolation, despair and death to the poor inhabitants of the Middle East. [1]
User avatar
karlchen
Level 10
Level 10
 
Posts: 3109
Joined: Sat Dec 31, 2011 7:21 am

Re: Bash Guru?

Postby Tejas_0 on Tue Mar 18, 2014 6:06 pm

karlchen wrote:\t \t \n, this is <tab> <tab> <enter> - And as stated before <tab> will invoke the bash filename/foldername completion.
That's right. So one has to be careful when copying command from file listing not to inadvertently include tab character after command :evil:
Release: Linux Mint 16 "petra"
Edition: Cinnamon 32-bit
Linux mint 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:12:00 UTC 2013 i686 athlon i686 GNU/Linux
Tejas_0
Level 3
Level 3
 
Posts: 187
Joined: Tue May 17, 2011 6:06 pm


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 2 guests