Re: Generating unique file names

2007-05-13 Thread Paul Jarc
matte <[EMAIL PROTECTED]> wrote: >The count would be sufficient, as each folder will always hold ONLY these >archives, and no hidden files. >Thus, my directory would be: >myArcName_1.tar.gz >myArcName_2.tar.gz >myArcName_3.tar.gz This will do it, starting the numbering at 0

Re: Generating unique file names

2007-05-13 Thread Chris F.A. Johnson
On 2007-05-13, matte wrote: > >I am doing a simple [1]backup Bash script that creates a backup archive of > a >folder (or file) I am working on. Where is the script? The link below is to the forums as a whole. > I want to have snapshaps all saved to one >directory. To ensure uniqu

Generating unique file names

2007-05-13 Thread matte
I am doing a simple [1]backup Bash script that creates a backup archive of a folder (or file) I am working on. I want to have snapshaps all saved to one directory. To ensure unique name, I am currently appending the date and time to "MyArcName_data_time." But this creates a long and ug

Re: newlines and $(...) processing

2007-05-13 Thread Bob Proulx
Andreas Schwab wrote: > [EMAIL PROTECTED] (Bob Proulx) writes: > > But when this is used with a command substitution the newline > > disappears. > > Command substitution always strips trailing newlines. Here is the part that I have previously missed: man bash Command Substitution .

Re: newlines and $(...) processing

2007-05-13 Thread Andreas Schwab
[EMAIL PROTECTED] (Bob Proulx) writes: > I was asked a question recently and I have not been able to deduce the > answer and so am appealing to the group for further education. I > could not find a match for my question in the FAQ. > > $ printf "\n" | od -tx1 > 000 0a > $ printf "\n" |

newlines and $(...) processing

2007-05-13 Thread Bob Proulx
I was asked a question recently and I have not been able to deduce the answer and so am appealing to the group for further education. I could not find a match for my question in the FAQ. $ printf "\n" | od -tx1 000 0a $ printf "\n" | wc -c 1 But when this is used with a command subst

Re: Bash is broken

2007-05-13 Thread Chris F.A. Johnson
On 2007-05-13, Overdorf, Sam wrote: > The following does not work on my computers: > > > > If [ "1" > "2" ] > > then > > echo "greater" > > else > > echo "not greater" > > fi > > > > Bash thinks this is I/O redirection and creates a file by the name of > "2" in my directory. > > Thi

Re: read 1 var in when executing command

2007-05-13 Thread Chris F.A. Johnson
On 2007-05-12, jdh239 wrote: > > I saw something similar to this in the archives already, but didn't see a > real answer. I am modifying my 'whois' command to just grep for the > expiration date of my domains: > > ie jwhois > > whois $DOM | grep -i expi | grep -i -e jan -e feb -e mar -e apr -e may

Re: Bash is broken

2007-05-13 Thread Stephane Chazelas
On Sun, May 13, 2007 at 08:19:13AM -0600, Eric Blake wrote: [...] > if [[ 1 > 2 ]] > > > This should be a string compare. > > Actually, when quoted properly, it should be a numeric comparison, not a > string comparison. [...] It *is* a string comparison: $ bash -c '[[ 02 > 1 ]]' || echo "02 is

Re: Bash is broken

2007-05-13 Thread Stephane Chazelas
On Sun, May 13, 2007 at 12:31:48AM -0700, Overdorf, Sam wrote: > The following does not work on my computers: [...] > If [ "1" > "2" ] [...] > Bash thinks this is I/O redirection and creates a file by the name of > "2" in my directory. > > This should be a string compare. [...] Hi. No, this shoul

Re: Bash is broken

2007-05-13 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Overdorf, Sam on 5/13/2007 1:31 AM: > The following does not work on my computers: > > > > If [ "1" > "2" ] > > then Your mailer corrupted what you typed, by adding spurious newlines, and capitalizing the if. Your report is not a

Bash is broken

2007-05-13 Thread Overdorf, Sam
The following does not work on my computers: If [ "1" > "2" ] then echo "greater" else echo "not greater" fi Bash thinks this is I/O redirection and creates a file by the name of "2" in my directory. This should be a string compare. Thanks, Sam ___