: Re: : Re: : bash script issue
Peter <plpeter2006-/[email protected]> Wed, 3 Sep 2014 15:19:49 +0000 (UTC)
| Newsgroups | gmane.org.user-groups.linux.tolug |
|---|---|
| Message-ID | <[email protected]> |
D. Hugh Redelmeier <hugh@...> writes: > I don't remember an ordinary shell context where a pathname can be > confused with number. Can you give an example? Ordinary not, but: echo $((07+1)) -> 8 (yes... why?) echo $((007+1)) -> 8 (hmm, must be Mr. Bond) echo $((077+1)) -> 64 (no kidding, 077oct is 64dec) echo $((078+1)) -> bash: 078: value too great for base (error token is "078") So if you do any math on any numbers for example numbered files like DCIM/IMG0077.jpg you WILL likely be bitten. I think the 1st application where I was bitten was many years ago trying to figure out missing and duplicate IMGnnnnn.jpg files in a large recovered image directory. I also tried to be clever and rename files such that there would be no gaps upon finding missing files, in one pass. That did not go well, I had a 10% or so file loss when done. There are many other 'opportunities' to get bitten. Peter -- The Toronto Linux Users Group. Meetings: http://gtalug.org/ TLUG requests: Linux topics, No HTML, wrap text below 80 columns How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists