Re: Bash with colors?

2009-02-15 Thread Antonio Macchi
commands like "ls --color" does not use terminfo capabilities... ...use instead fixed strings (without regards about TERMinal) is this a good (and safe) choice too? IMHO not. Too many assumptions. GNU ls seems to always assume an ANSI terminal, regardless which TERM is set. Or did I miss some

Re: Bash with colors?

2009-02-15 Thread Jan Schampera
Antonio Macchi wrote: > commands like "ls --color" does not use terminfo capabilities... > > ...use instead fixed strings (without regards about TERMinal) > is this a good (and safe) choice too? IMHO not. Too many assumptions. GNU ls seems to always assume an ANSI terminal, regardless which TER

Re: Bash with colors?

2009-02-15 Thread Antonio Macchi
Start at http://bash-hackers.org/wiki/doku.php/scripting/terminalcodes commands like "ls --color" does not use terminfo capabilities... $ hexdump -c <(TERM=xterm ls -d / --color=always) 000 033 [ 0 0 m 033 [ 0 1 ; 3 4 m / 033 [ 010 0 0 m \n 033 [ m

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Mike Frysinger
On Sunday 15 February 2009 23:39:03 Paul Jarc wrote: > Mike Frysinger wrote: > > the op wasnt asking for the time, they were asking for the last created > > file. and the ls man page talks how to sort by ctime. > > ctime is the time when the inode was last modified, not (necessarily) > the time wh

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Jan Schampera
Mike Frysinger wrote: >> Without looking there: It can't be documented, because there's no >> general way to retrieve the creation time of a file. > > the op wasnt asking for the time, they were asking for the last created file. > > and the ls man page talks how to sort by ctime. Yes, that's

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Paul Jarc
Mike Frysinger wrote: > the op wasnt asking for the time, they were asking for the last created file. > > and the ls man page talks how to sort by ctime. ctime is the time when the inode was last modified, not (necessarily) the time when the file was created. paul

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Mike Frysinger
On Sunday 15 February 2009 23:19:28 Jan Schampera wrote: > Mike Frysinger wrote: > >> there is any way to get the last file that created that is fomat is > >> *.sql > > > > why not just use `ls` and one of its sort options ? the ls man page > > documents how to sort by creation time > > Without

Re: No tilde expansion right after a quotation

2009-02-15 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Angel Tsankov on 2/15/2009 3:02 PM: > I tried CPATH="${CPATH}${CPATH:+:}"~usr1/blah/blah. (I quote > expansions just to be on the safe side, though I think home directories may > not contain spaces.) There are some contexts, such as va

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Paul Jarc
tal396 wrote: > Coz its could be find in alot of subdirs > like > /home/server/backups/local_backups/1-1-2009/server/mysql/1-1-2009.sql > /home/server/backups/local_backups/1-2-2009/server/mysql/1-2-2009.sql > /home/server/backups/local_backups/1-3-2009/server/mysql/1-3-2009.sql This will show th

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread tal396
Coz its could be find in alot of subdirs like /home/server/backups/local_backups/1-1-2009/server/mysql/1-1-2009.sql /home/server/backups/local_backups/1-2-2009/server/mysql/1-2-2009.sql /home/server/backups/local_backups/1-3-2009/server/mysql/1-3-2009.sql so any idea? Bugzilla from vap...@gen

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Jan Schampera
Mike Frysinger wrote: >> there is any way to get the last file that created that is fomat is *.sql > why not just use `ls` and one of its sort options ? the ls man page > documents > how to sort by creation time > -mike Without looking there: It can't be documented, because there's no gener

Re: Bash with colors?

2009-02-15 Thread Jan Schampera
tal396 wrote: > there is any way to echo "aaa" or any msg in colors? Start at http://bash-hackers.org/wiki/doku.php/scripting/terminalcodes and continue at whatever Google spits out for: - bash colors - terminal colors - ANSI colors - VT100 colors J.

Re: "unset HISTFILESIZE" not working in .bashrc

2009-02-15 Thread Chet Ramey
per...@pluto.rain.com wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i386 > OS: freebsd6.1 > Compiler: cc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' > -DCONF_OSTYPE='freebsd6.1' -DCONF_MACHTYPE='i386-portbld-freebsd6.1' > -DCONF_VENDOR=

Re: No tilde expansion right after a quotation

2009-02-15 Thread Jon Seymour
On Mon, Feb 16, 2009 at 12:11 PM, Paul Jarc wrote: > Jon Seymour wrote: >> The manual specifies a rule for ${parameter:+word}, but not >> ${parameter+word}. > > It's there, but easy to miss: > In each of the cases below, word is subject to tilde expansion, parame- > ter expansion, c

Re: No tilde expansion right after a quotation

2009-02-15 Thread Paul Jarc
Jon Seymour wrote: > The manual specifies a rule for ${parameter:+word}, but not > ${parameter+word}. It's there, but easy to miss: In each of the cases below, word is subject to tilde expansion, parame- ter expansion, command substitution, and arithmetic expansion. When

Re: No tilde expansion right after a quotation

2009-02-15 Thread Paul Jarc
"Angel Tsankov" wrote: > How do you know that $# is always set? And what about $...@? To what values > are these parameters set outside any function? $# gives the number of positional parameters. If there aren't any positional parameters, then it's set to 0. In the man page, under PARAMETERS

Re: No tilde expansion right after a quotation

2009-02-15 Thread Jon Seymour
$# is the number of position parameters in the current context, so it will always have well defined value. Technically, $? does not have a well-defined value if there hasn't been a previously executed foreground pipeline but in practice seems to have the value 0, so could be used too. $@ wouldn't

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Mike Frysinger
On Sunday 15 February 2009 10:32:15 tal396 wrote: > hey, i created a backup dir that created backup every hours... > there is any way to get the last file that created that is fomat is *.sql > ? > thats what i've done, but its not working so well... > > > cd "/home/server/backups/local_backups/

Re: No tilde expansion right after a quotation

2009-02-15 Thread Jon Seymour
On Mon, Feb 16, 2009 at 11:44 AM, Paul Jarc wrote: > Jon Seymour wrote: >> On Mon, Feb 16, 2009 at 10:22 AM, Paul Jarc wrote: >>> CPATH=${CPATH:+$CPATH:}${#+~usr1/blah/blah} >> >> Out of interest, how does one derive that outcome from the documented >> behaviour of bash? That is, which expansion

Re: No tilde expansion right after a quotation

2009-02-15 Thread Angel Tsankov
Paul Jarc wrote: > Jon Seymour wrote: >> On Mon, Feb 16, 2009 at 10:22 AM, Paul Jarc wrote: >>> CPATH=${CPATH:+$CPATH:}${#+~usr1/blah/blah} >> >> Out of interest, how does one derive that outcome from the documented >> behaviour of bash? That is, which expansion rules are being invoked? > > It's

Re: No tilde expansion right after a quotation

2009-02-15 Thread Angel Tsankov
Jon Seymour wrote: > On Mon, Feb 16, 2009 at 10:22 AM, Paul Jarc wrote: >> Jon Seymour wrote: >>> If the builtin echo fails it will be because the bash interpreter >>> has suffered a catastrophic failure of some kind [ e.g. run out of >>> memory ]. Once that has happened, all bets are off anyway.

Re: No tilde expansion right after a quotation

2009-02-15 Thread Paul Jarc
Jon Seymour wrote: > On Mon, Feb 16, 2009 at 10:22 AM, Paul Jarc wrote: >> CPATH=${CPATH:+$CPATH:}${#+~usr1/blah/blah} > > Out of interest, how does one derive that outcome from the documented > behaviour of bash? That is, which expansion rules are being invoked? It's ${parameter+word}, using $#

Bash with colors?

2009-02-15 Thread tal396
there is any way to echo "aaa" or any msg in colors? -- View this message in context: http://www.nabble.com/Bash-with-colors--tp22023794p22023794.html Sent from the Gnu - Bash mailing list archive at Nabble.com.

Help: Bash script that show you the last file created?

2009-02-15 Thread tal396
hey, i created a backup dir that created backup every hours... there is any way to get the last file that created that is fomat is *.sql ? thats what i've done, but its not working so well... cd "/home/server/backups/local_backups/" ; find -type d | find . -name '*.sql' | tac | tail -1;

Re: No tilde expansion right after a quotation

2009-02-15 Thread Jon Seymour
On Mon, Feb 16, 2009 at 10:22 AM, Paul Jarc wrote: > Jon Seymour wrote: >> If the builtin echo fails it will be because the bash interpreter has >> suffered a catastrophic failure of some kind [ e.g. run out of memory >> ]. Once that has happened, all bets are off anyway. > > Probably true, but c

Re: No tilde expansion right after a quotation

2009-02-15 Thread Angel Tsankov
Paul Jarc wrote: > Jon Seymour wrote: >> If the builtin echo fails it will be because the bash interpreter has >> suffered a catastrophic failure of some kind [ e.g. run out of memory >> ]. Once that has happened, all bets are off anyway. > > Probably true, but command substitution forks a separat

Re: No tilde expansion right after a quotation

2009-02-15 Thread Paul Jarc
Jon Seymour wrote: > If the builtin echo fails it will be because the bash interpreter has > suffered a catastrophic failure of some kind [ e.g. run out of memory > ]. Once that has happened, all bets are off anyway. Probably true, but command substitution forks a separate process, so that can fa

Re: No tilde expansion right after a quotation

2009-02-15 Thread Angel Tsankov
Jon Seymour wrote: > If you are willing to trade conciseness in order to eliminate use of > builtin commands, you can use. > > local tmp=~usr1/blah/blah > CPATH="${CPATH}${CPATH:+:}${tmp}" > > However, if you are concerned about echo failing, then you also need > to be concerned about local faili

Re: No tilde expansion right after a quotation

2009-02-15 Thread Jon Seymour
If you are willing to trade conciseness in order to eliminate use of builtin commands, you can use. local tmp=~usr1/blah/blah CPATH="${CPATH}${CPATH:+:}${tmp}" However, if you are concerned about echo failing, then you also need to be concerned about local failing. Hence: local tmp=~usr1/

Re: No tilde expansion right after a quotation

2009-02-15 Thread Angel Tsankov
Jon Seymour wrote: > On Mon, Feb 16, 2009 at 9:26 AM, Angel Tsankov > wrote: >> Jon Seymour wrote: >>> There may be other ways to do this, but: >>> >>> CPATH="${CPATH}${CPATH:+:}$(echo ~usr1/blah/blah)" >>> >>> should work. >> >> Well, I'd like to avoid the use of external commands. >> > > ech

Re: No tilde expansion right after a quotation

2009-02-15 Thread Jon Seymour
On Mon, Feb 16, 2009 at 9:26 AM, Angel Tsankov wrote: > Jon Seymour wrote: >> There may be other ways to do this, but: >> >> CPATH="${CPATH}${CPATH:+:}$(echo ~usr1/blah/blah)" >> >> should work. > > Well, I'd like to avoid the use of external commands. > echo is a builtin, so if you are worri

Re: No tilde expansion right after a quotation

2009-02-15 Thread Angel Tsankov
Jon Seymour wrote: > There may be other ways to do this, but: > > CPATH="${CPATH}${CPATH:+:}$(echo ~usr1/blah/blah)" > > should work. Well, I'd like to avoid the use of external commands. --Angel

Re: No tilde expansion right after a quotation

2009-02-15 Thread Jon Seymour
There may be other ways to do this, but: CPATH="${CPATH}${CPATH:+:}$(echo ~usr1/blah/blah)" should work. jon. On Mon, Feb 16, 2009 at 9:02 AM, Angel Tsankov wrote: > Chet Ramey wrote: >> Angel Tsankov wrote: >>> Hi, >>> >>> Using bash 3.2.48(1)-release, echo ""~root prints ~root instead

Re: No tilde expansion right after a quotation

2009-02-15 Thread Angel Tsankov
Chet Ramey wrote: > Angel Tsankov wrote: >> Hi, >> >> Using bash 3.2.48(1)-release, echo ""~root prints ~root instead of >> /root. Is this the expected behaviour? > > Yes. The tilde is not the first character in the word. Portions of > words to be tilde-expanded can't be quoted at all, either.

Re: No tilde expansion right after a quotation

2009-02-15 Thread Chet Ramey
Angel Tsankov wrote: > Hi, > > Using bash 3.2.48(1)-release, echo ""~root prints ~root instead of /root. > Is this the expected behaviour? Yes. The tilde is not the first character in the word. Portions of words to be tilde-expanded can't be quoted at all, either. Chet -- ``The lyf so shor

No tilde expansion right after a quotation

2009-02-15 Thread Angel Tsankov
Hi, Using bash 3.2.48(1)-release, echo ""~root prints ~root instead of /root. Is this the expected behaviour? Angel Tsankov

"unset HISTFILESIZE" not working in .bashrc

2009-02-15 Thread perryh
Configuration Information [Automatically generated, do not change]: Machine: i386 OS: freebsd6.1 Compiler: cc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='freebsd6.1' -DCONF_MACHTYPE='i386-portbld-freebsd6.1' -DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/loc