Re: subshell vs. su and +e
"BuraphaLinux Server" <[EMAIL PROTECTED]> writes: > su -p nobody -s /sbin/bash << EOF > export HOME=/tmp > # turn off error crashing and turn on tracing > set +e -x > # begin the non-root stuff here > cd /tmp/mindy > shazbot is not a valid command > if ((${?}!=0)) # <--- ${?} is zero here not 127 ? The variable is already substituted while the here-document is read. Either quote the dollar sign, or use a quoted here-document. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: ctrl+r + left cursor + multiline PS1 = wrong cursor displaying
Xuefer wrote: > Bash Version: 3.2 > Patch Level: 15 > > expected: cursor moves in the range of "echo abc", and the[n] beyond "c" > actually: cursor moves in the range of "$ echo ab" (including b) Please try again with patch level 17. With bash-3.2.17 I cannot reproduce that behaviour here. > Repeat-By: > $ PSCOLOR=36 > $ export PS1='\[\e['$PSCOLOR'[EMAIL PROTECTED] > \[\e[34m\]\w\n\$\[\e[0m\] ' > $ echo abcdefg > $ > (reverse-i-search)`': abc Benno ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Subnet address
On 7/20/07, Mike Frysinger <[EMAIL PROTECTED]> did not read the question. The answer is: /sbin/ifconfig eth0 | grep 'inet addr' | tr .: ' ' | (read inet addr a b c d Bcast e f g h Mask i j k l; echo $(($a & $i)).$(($b & $j )).$(( $c & $k )).$(( $d & $l )) ) ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: bug in printf bash command
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to James Youngman on 7/21/2007 8:25 AM: [thread starts at http://lists.gnu.org/archive/html/bug-coreutils/2007-07/msg00060.html] >>> [EMAIL PROTECTED] "%02i" 09 >>> -bash: printf: 09: invalid number >> >> printf "%02i" 011 >> >> gets you 09. > > > Obviously, "Invalid octal number" would have been a more helpful error > message. Not as obvious, this was reported to the wrong list. Coreutils' printf does this: $ /bin/printf %02i 09 /bin/printf: 09: value not completely converted It is bash's printf which could be improved, so I'm forwarding this to the bug-bash list. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGohl984KuGfSFAYARAujQAJ9kBTfP0R9HF21dn5FpH+X76cmZtACg0ntu CektDEFvNbq4C4fw1IZAX5A= =lXtC -END PGP SIGNATURE- ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Subnet address
On 7/21/07, Archimerged Ark Submedes <[EMAIL PROTECTED]> wrote: On 7/20/07, Mike Frysinger <[EMAIL PROTECTED]> did not read the question. Neither did you. ;-) Asked for was a solution using ifconfig and bash; you added grep and tr. Yes, that's entirely reasonable on your part, but it's not necessary. The answer is: /sbin/ifconfig eth0 | grep 'inet addr' | tr .: ' ' | (read inet addr a b c d Bcast e f g h Mask i j k l; echo $(($a & $i)).$(($b & $j )).$(( $c & $k )).$(( $d & $l )) ) Here's an ugly way to do it: NETADDR=`/sbin/ifconfig | while read w d z z; do if [ "$w" = "inet" ]; then d=${d#addr:}; z=${z#Mask:}; a=${d%%.*}; w=${z%%.*}; d=${d#*.}; z=${z#*.}; b=${d%%.*}; x=${z%%.*}; d=${d#*.}; z=${z#*.}; c=${d%%.*}; y=${z%%.*}; d=${d#*.}; z=${z#*.}; echo $((a&w)).$((b&x)).$((c&y)).$((d&z)); break; fi; done` And here's a better way, inspired by your use of 'tr': NETADDR=`/sbin/ifconfig | while read w x y y; do if [ "$w" = "inet" ]; then set -- ${x//./ }; a=${1#addr:}; b=$2; c=$3; d=$4; set -- ${y//./ }; w=${1#Mask:}; x=$2; y=$3; z=$4; echo $((a&w)).$((b&x)).$((c&y)).$((d&z)); break; fi; done` Dave ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
deleting coma in a large number of files
Hello, as said in the title, I have suppress all comas in a lot of text files located in the same directory, all having the same name but with a different number at the end (year1, year2, year3, ...). I'm sure this can be done very rapidly in bash but have no idea of how to write it! Thanks if you can help, Timothée -- View this message in context: http://www.nabble.com/deleting-coma-in-a-large-number-of-files-tf4118796.html#a11713484 Sent from the Gnu - Bash mailing list archive at Nabble.com. ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: deleting coma in a large number of files
Timothee wrote: > as said in the title, I have suppress all comas in a lot of text files > located in the same directory, all having the same name but with a different > number at the end (year1, year2, year3, ...). > > I'm sure this can be done very rapidly in bash but have no idea of how to > write it! This is easier done in 'sed' than in 'bash'. sed --in-place 's/,//g' * Be sure to try it without the --in-place option to verify that it does what you want before you fire it for effect! Bob ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Subnet address
On Saturday 21 July 2007, Archimerged Ark Submedes decided to be rude: > On 7/20/07, Mike Frysinger <[EMAIL PROTECTED]> did not read the question. > > The answer is: funny, you just backed up my statement completely. there is no utility that'll give you the subnet address straight, you'll need to calculate it by hand. in the future you might want to consider being less of a jerk. -mike signature.asc Description: This is a digitally signed message part. ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: deleting coma in a large number of files
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Timothee on 7/20/2007 12:22 PM: > Hello, > as said in the title, I have suppress all comas in a lot of text files > located in the same directory, all having the same name but with a different > number at the end (year1, year2, year3, ...). You weren't clear whether the commas you wanted to remove were inside the files' contents (in which case, the Bob's answer of using sed is better), or in the file names. If the latter, then a mass renaming can be done as follows: for f in *,; do mv $f ${f%%,}; done - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGooW784KuGfSFAYARApisAKCZE6tmeQuI3f6mvASRSDJ/DKBR2QCgnE/3 9hnQucJ2AIW5A2/yHEv+4ew= =JArZ -END PGP SIGNATURE- ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash