Re: Redirection between assignment statement and command name prevents alias substitution

2021-03-25 Thread Chris F.A. Johnson
I couldn't use a function (which I do for all interactive uses) because that would change $FUNCNAME. -- Chris F.A. Johnson <http://cfajohnson.com/> === Author: === Shell Scripting Recipes: A Problem-Soluti

Re: Extended regex match (shmatch.c:115) malloc error

2021-08-09 Thread Chris F.A. Johnson
free: start and end chunk sizes differ Aborting...ABORT instruction (core dumped) -------------- I get: '123' in '123 text!' (bash 5.1 in mate-terminal) -- Chris F.A. Johnson

RFE: new option affecting * expansion

2021-08-10 Thread Chris F.A. Johnson
It would be nice if there were an option to allow * to expand sorted by timestamp rather than aphabetically. -- Chris F.A. Johnson <http://cfajohnson.com/> === Author: === Shell Scripting Recipes: A P

Re: RFE: new option affecting * expansion

2021-08-11 Thread Chris F.A. Johnson
On Wed, 11 Aug 2021, Chet Ramey wrote: On 8/10/21 5:08 PM, Chris F.A. Johnson wrote: It would be nice if there were an option to allow * to expand sorted by timestamp rather than aphabetically. When you say `timestamp' I assume you mean by last modification time. Yes, that's wh

Re: static vs. dynamic scoping

2010-11-09 Thread Chris F.A. Johnson
t a=local; f2; echo $a; }; function f2 { echo $a; a=changed; }; a=global; f1; echo $a' global local changed $ bash --posix -c 'function f1 { typeset a=local; f2; echo $a; }; function f2 { echo $a; a=changed; }; a=global; f1; echo $a' local changed global ... I find the bash be

Re: ionice bash pid in bash_profile Fails

2010-11-22 Thread Chris F.A. Johnson
ID of the shell. The following works like a charm: # See ionice manfile - give high priority to Bash ionice -c 2 -n 0 -p `echo $$` Why are you using echo? ionice -c 2 -n 0 -p $$ -- Chris F.A. Johnson, <http://cfajohnson.com> Author: Pro Bash Programming: Scripting the GNU/

Re: Clear Screen

2010-12-01 Thread Chris F.A. Johnson
the options to xterm (man xterm). (There may not be an option that does what you want.) -- Chris F.A. Johnson, <http://cfajohnson.com> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: IFS=':' set -- aa:bb:cc:dd # Fails to set "$@"

2010-12-01 Thread Chris F.A. Johnson
7; set -- aa:bb:cc:dd IFS="$oldIFS" BTW, the same behavior happens in bash4. Fix: Offered in the constructive spirit to see if this needs to be fixed or if this is a deliberate or known behavior. That is the way it should behave. The line is p

Re: cd with multiple arguments?

2010-12-14 Thread Chris F.A. Johnson
other language; the shell is more than adequate for all my programming needs. -- Chris F.A. Johnson, <http://cfajohnson.com> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: Command substitution (backtick) and tab completion

2010-12-31 Thread Chris F.A. Johnson
. Yes, it works in 3.2 but not in 4.[012]. -- Chris F.A. Johnson, <http://cfajohnson.com> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: 'help set' missing '--'

2011-01-10 Thread Chris F.A. Johnson
On Mon, 10 Jan 2011, Jan Schampera wrote: the help output for the set builtin command misses '--'. It's there: SYNOPSIS set [--abefhkmnptuvxBCHP] [-o option-name] [arg ...] -- Chris F.A. Johnson, <http://cfajohnson.com> Author: Pro Bash Programming: Sc

Re: 'help set' missing '--'

2011-01-10 Thread Chris F.A. Johnson
On Mon, 10 Jan 2011, Christopher Roy Bratusek wrote: On Monday 10 January 2011 09:06:42 Chris F.A. Johnson wrote: On Mon, 10 Jan 2011, Jan Schampera wrote: the help output for the set builtin command misses '--'. It's there: SYNOPSIS set [--abefhkmnptuvxBCHP] [-o op

Re: Mapfile callback access to current line

2011-01-14 Thread Chris F.A. Johnson
line just read (and already assigned to the array). IOW, this script would print the file: xx() { printf "%3d %s\n" "$1" "${l[$1]}" } mapfile -c1 -C xx -t l < ~/.bashrc Now, "${l[$1]}" is empty; it would be great if it contained the lin

Re: multi-line commands in the history get split when bash is quit

2011-02-05 Thread Chris F.A. Johnson
stamps are written to the history file so they may be preserved across shell sessions. However this is not done in any version of bash that I can find. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2

Re: Don't show help of `readonly' and `readarray' when I run `help read'

2011-02-10 Thread Chris F.A. Johnson
treating the pattern like glob pattern matching usually works (anchored to beginning and end). I totally agree. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: [bash4.2] ${v//[/} bug?

2011-02-15 Thread Chris F.A. Johnson
It's a bug, and I will release a patch. In the meantime, see if the attached patch does the right thing on your platform. On Mandriva, I get '[hello'; after applying the patch I get 'hello'. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Ba

Re: bash doesn't act like mksh at all

2011-02-28 Thread Chris F.A. Johnson
nquoted $@ on rhs differently, expanding it like $*: Unquoted $@ *is* the same as $*. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: case modification won't work with pattern

2011-03-10 Thread Chris F.A. Johnson
er Bar $ echo ${foo^^} ## Convert all characters BAR $ echo ${foo^[a-m]} ## Convert first character that matches pattern Bar $ echo ${foo^^[a-m]} ## Convert all characters that match pattern BAr -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scrip

Negative array subscript with unset

2011-03-12 Thread Chris F.A. Johnson
I all versions I have tried, unsetting an array element using a negative index fails: $ array=( q w e r t y ) $ unset 'array[-1]' bash: [-1]: bad array subscript -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/L

Re: BASH_SUBSHELL documentation misleading

2011-03-23 Thread Chris F.A. Johnson
the same answer for BASH_SUBSHELL No, it suggests that: echo $BASH_SUBSHELL ; ( echo $BASH_SUBSHELL ) would not give the same answer for BASH_SUBSHELL In your example, the second "echo $BASH_SUBSHELL" is at the same depth as the first. -- Chris F.A. Johnson, <http://cfa

Re: awk or sed

2011-04-05 Thread Chris F.A. Johnson
sing tools. I wonder if anybody have experience with them or any other means to do it. printf "%s\n" $var1 (You might want to precede that with 'set -f'.) -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shel

Re: Another mapfile question.

2011-08-06 Thread Chris F.A. Johnson
and don't change it back within a function: foo() { local IFS=bar : whatever } The original value is not changed in the calling script. -- Chris F.A. Johnson <http://cfaj.freeshell.org> ==

Re: bash-completion between do and done

2011-11-05 Thread Chris F.A. Johnson
? On what version of bash? I can confirm it on 3.05b, 3.0 and 4.2: while [ ${n:=0} -lt 5 ] do se All I get is a beep. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A

Re: Questions about commandline-args

2011-11-11 Thread Chris F.A. Johnson
te it: personal_function "ab{c,d}" -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: Questions about commandline-args

2011-11-11 Thread Chris F.A. Johnson
On Sat, 12 Nov 2011, Christopher Roy Bratusek wrote: On Friday 11 November 2011 19:32:51 Chris F.A. Johnson wrote: On Fri, 11 Nov 2011, Christopher Roy Bratusek wrote: Hi list, I've got a question about commandline args, imagine: personal_function ab{c,d} personal_function will receiv

Re: invoke tilde expansion on quoted string

2011-11-11 Thread Chris F.A. Johnson
ive to do tilde expansion on it. var='~/..' cd $var#how to change this line? eval "cd $var" -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: converting array to string by quoting each element for eval

2011-11-15 Thread Chris F.A. Johnson
"printf 'x%sx\n' $arg_string" eval "$cmd" ~/linux/bin/src/bash/quotearg/main$ ./main.sh 'a' 'b' 'c' ''\''' ' ' '"' 'a' 'a b' xax xax xbx xax xa bx -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: converting array to string by quoting each element for eval

2011-11-15 Thread Chris F.A. Johnson
rguments in a single string is almost always the wrong way to go about it. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: converting array to string by quoting each element for eval

2011-11-15 Thread Chris F.A. Johnson
quot; eval "$cmd" echo $cmd See above. /tmp$ ./not_convert_args_to_string.sh . "-type f -name '*'" find: `./cvcd': Permission denied find . -type f -name '*' Use 'set -x' to see exactly what your script is doing. -- Chris F.A.

Re: converting array to string by quoting each element for eval

2011-11-15 Thread Chris F.A. Johnson
On Tue, 15 Nov 2011, Peng Yu wrote: On Tue, Nov 15, 2011 at 6:43 PM, Chris F.A. Johnson wrote: On Tue, 15 Nov 2011, Peng Yu wrote:    In any case, combining a command and its arguments in a single    string is almost always the wrong way to go about it. Please compare the two scripts and

Re: bash 3.2 vs 3.0

2012-01-05 Thread Chris F.A. Johnson
On Thu, 5 Jan 2012, Dave wrote: Hi all, Recently upgraded to 3.2 and noticed some differences in a lot of my scripts, consider the following example: ... Could anyone point me in correct direction on this one ? Upgrade to 4.2; you are years behind the times! -- Chris F.A. Johnson

Re: test if shell is interactive

2012-01-22 Thread Chris F.A. Johnson
: if [ -t 1 ] then echo Interactive else echo Not interactive fi -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-08 Thread Chris F.A. Johnson
-- yet it works, and old code seems to rely on it -- and "$[(1+2)/3]" looks cleaner than "$(((1+2)/3))". So what's up with that? At the minor expense of a few extra keystrokes, $(( (1+2) / 3 )) looks just as clean, and has the added cachet of being portable. --

Re: ((i++)) no longer supported?

2012-05-03 Thread Chris F.A. Johnson
)) -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: locale specific ordering in EN_US -- why is a

2012-05-21 Thread Chris F.A. Johnson
=C in your scripts. My OS uses "en_US.UTF-8". My OS uses whatever I tell it to (which is C). You'd think unicode would have something to say about collation order that wouldn't allow such randomness, but maybe not. -- Chris F.A. Johnson, <http://cfajohnson.com/&

Re: why must non-standard $IFS members be treated so differently ?

2012-07-29 Thread Chris F.A. Johnson
v=($@); echo ${#v[@]}; } Always quote $@. Without quotes, it's the same as $* function count_args {v=( "$@" ); echo ${#v[@]}; } -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux She

Re: Double quoted history expansion character cannot be escaped

2012-08-06 Thread Chris F.A. Johnson
is in ~/.bashrc: histchars= -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: Parsing error when "case" in "for" in $()

2012-09-11 Thread Chris F.A. Johnson
n the case statement is being interpreted as the closing for $( Fix: Probably by fixing the bash parser. Balance the parentheses in the case statement: echo $(for x in whatever; do case y in (*) echo 42;; esac; done) -- Chris F.A. Johnson, <http://cfajohnson.com/> Autho

RFE: read -d STRING

2012-11-23 Thread Chris F.A. Johnson
I would find it very useful to allow a string of delimiters to be used with 'read -d', with any member of the string terminating the input and the character used being stored in a variable, e.g. READ_DELIM. -- Chris F.A. Johnson, <http://cfajohnson.com/> Aut

Re: fd leak with {fd}>

2012-11-26 Thread Chris F.A. Johnson
On Mon, 26 Nov 2012, Chet Ramey wrote: ,,, There have been unsuccessful new features -- the case-modifying expansions are one example of a swing and miss. A miss? I use them a lot. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting t

Re: More fun with IFS

2013-01-29 Thread Chris F.A. Johnson
$@" ... one:::two three:::four # good Zsh and pdkshes produce: one:::two:three:::four For all of the above, which I think is wrong for the last 4. ksh93 produces: one:::two three:::four for the last 4, which I think is correct. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: More fun with IFS

2013-01-30 Thread Chris F.A. Johnson
On Wed, 30 Jan 2013, Andreas Schwab wrote: "Chris F.A. Johnson" writes: var=${a[*]} ... one two three four # bad Looks good to me. It expands to multiple words, just as an unquoted $* would do. But no field splitting is performed on the expansion, so why are the c

Re: Bug/limitation in 'time'

2013-03-16 Thread Chris F.A. Johnson
echo Just did $1 iterations using expr math } -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: Bug/limitation in 'time'

2013-03-16 Thread Chris F.A. Johnson
On Sun, 17 Mar 2013, William Park wrote: On Sat, Mar 16, 2013 at 10:15:50PM -0400, Chris F.A. Johnson wrote: On Sun, 17 Mar 2013, Chris Down wrote: ExprCount() { for (( i = $1 ; i > 0 ; i-- )); do : done echo "$1 iterations" } Or, in a PO

RE: Bug/limitation in 'time'

2013-03-17 Thread Chris F.A. Johnson
On Sun, 17 Mar 2013, Bruce Dawson wrote: Chris Down pointed that out. My loop now looks like this -- portable (I believe) and fast: BashCount() { for (( i = $1 ; i > 0 ; i-- )); do No, that is not portable. The only portable use of (( ... )) is $(( ... )) -- Chris F.A. John

Re: Local variables overriding global constants

2013-04-03 Thread Chris F.A. Johnson
rks because both instances are local to a function and don't exist outside their own functions. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: Local variables overriding global constants

2013-04-03 Thread Chris F.A. Johnson
On Wed, 3 Apr 2013, Nikolai Kondrashov wrote: On 04/03/2013 10:53 AM, Chris Down wrote: On 2013-04-03 10:50, Nikolai Kondrashov wrote: On 04/03/2013 10:43 AM, Chris F.A. Johnson wrote: On Wed, 3 Apr 2013, Nikolai Kondrashov wrote: I.e. this: bash -c 'declare -r v; a() { declare -r v;

Re: Local variables overriding global constants

2013-04-03 Thread Chris F.A. Johnson
readonly in the global scope. (Also readonly defers from declare -r: bash -c 'a() { declare -r v=2;echo "$v"; }; b () { readonly v=1; a; echo "$v"; }; b; v=2' $ bash -c 'a() { declare -r v=2;echo "$v"; }; b () { readonly v=1; a; echo "$v"; }; b;

Re: Local variables overriding global constants

2013-04-03 Thread Chris F.A. Johnson
On Wed, 3 Apr 2013, Pierre Gaston wrote: On Wed, Apr 3, 2013 at 11:33 AM, Chris F.A. Johnson wrote: On Wed, 3 Apr 2013, Pierre Gaston wrote: On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote: On 2013-04-03 11:00, Nikolai Kondrashov wrote: It doesn't work because you are tryi

Re: Interpretation of escapes in expansions in pattern matching contexts

2013-04-06 Thread Chris F.A. Johnson
== $x ]; then echo yes; else echo no; fi no But not in ksh93: $ x=\\x; if [[ x == $x ]]; then echo yes; else echo no; fi no $ x=\\x; if [ x == $x ]; then echo yes; else echo no; fi no -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the

Re: `declare -fp` mishandles heredoc with || statement

2013-05-31 Thread Chris F.A. Johnson
On Fri, 31 May 2013, Mike Frysinger wrote: simple code snippet: $ cat test.sh func() { cat > / < / < With 4.2.37: func () { cat > / <11 EOF echo FAIL } -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the

Re: currently doable? Indirect notation used w/a hash

2013-06-10 Thread Chris F.A. Johnson
to switch languages entirely. It is not the least bit difficult with eval: eval "array=( \"\${$1[@]}\" )" -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

Re: currently doable? Indirect notation used w/a hash

2013-06-10 Thread Chris F.A. Johnson
On Mon, 10 Jun 2013, Chris Down wrote: Enjoy your arbitrary command execution. Can you give me an example, using the code I posted, where that would happen? On 10 Jun 2013 14:15, "Chris F.A. Johnson" wrote: On Mon, 10 Jun 2013, Greg Wooledge wrote: On Sun, Jun 09, 2013 at

Re: currently doable? Indirect notation used w/a hash

2013-06-10 Thread Chris F.A. Johnson
On Mon, 10 Jun 2013, Greg Wooledge wrote: On 10 Jun 2013 14:15, "Chris F.A. Johnson" wrote: It is not the least bit difficult with eval: eval "array=( \"\${$1[@]}\" )" On Mon, Jun 10, 2013 at 09:17:23PM +0800, Chris Down wrote: Enjoy your arbitrary c

Re: currently doable? Indirect notation used w/a hash

2013-06-10 Thread Chris F.A. Johnson
On Mon, 10 Jun 2013, Greg Wooledge wrote: On Mon, Jun 10, 2013 at 10:23:10AM -0400, Chris F.A. Johnson wrote: On Mon, 10 Jun 2013, Chris Down wrote: Enjoy your arbitrary command execution. Can you give me an example, using the code I posted, where that would happen? On 10 Jun 2013

Re: currently doable? Indirect notation used w/a hash

2013-06-10 Thread Chris F.A. Johnson
uppress the error you got about not being able to remove ".". Contortions??? Now they put in a special check to check the starting arguments first, before doing the depth-first remove and abort any processing for files in "." You need to use 'find' with

Re: corrupted input after size function (input that's not recorded by bash)

2013-06-13 Thread Chris F.A. Johnson
per execution, but isn't recorded by bash? (this has been one of those things that's bothered me for years, but never been important enough to even ask about... I thought I'd look at it to fix it, but still don't see why it does what it does). Any clues? The baskspaces (\b) a

Re: History file clobbered by multiple simultaneous exits

2013-07-11 Thread Chris F.A. Johnson
On Wed, 10 Jul 2013, ge...@cs.hmc.edu wrote: ... What might be cooler would be to merge all the history lines from all shells, in timestamp order. But given the current history file format, that seems...hard. PROMPT_COMMAND='history -a "$HISTFILE"&#x

Re: quotes in bash script

2013-07-12 Thread Chris F.A. Johnson
S is subject to word splitting. Try this instead: PARAMS_FOR_LS=( -alst "dir with spaces" ) ls "${PARAMS_FOR_LS[@]}" See also <http://mywiki.wooledge.org/BashFAQ/050>. -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: S

Re: ldapscripts unusable from within a 'while read line' loop

2013-08-01 Thread Chris F.A. Johnson
fact, ldapid works in every other loop except a 'while read line' and I really do not have any idea why. I have no idea what ldapid is or does (I can't find it for my system), but perhaps it reads from stdin? If it does, it will be reading from the file. -- Chris F.A. Jo

Re: i++ cause bad return code when result is 1

2013-08-26 Thread Chris F.A. Johnson
hat it is != 0 Compare: $ (( 0 )); echo "$?" 1 $ (( 1 )); echo "$?" 0 $ (( -1 )); echo "$?" 0 -- Chris F.A. Johnson, <http://cfajohnson.com/> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Rec

bug-bash@gnu.org

2013-10-28 Thread Chris F.A. Johnson
t is limited in functionality. I.e.: ls !($(echo *+(-IGN-)*|tr " " "|")) I tried the above in a dir that has 2 files w/the pattern, and 532 w/o, and it worked, but how much of that was 'luck'? Is there a better bash-pattern that doesn't use tr and such? ls !(*-IGN-*) -- Chris F.A. Johnson, <http://cfajohnson.com/>

Re: continuously evaluated prompts/environmental variables

2013-11-26 Thread Chris F.A. Johnson
oami`@`hostname`' -- Chris F.A. Johnson, <http://cfajohnson.com>

Re: odd behavior from overloading the "source" builtin

2014-03-16 Thread Chris F.A. Johnson
On Sun, 16 Mar 2014, Doug McIlroy wrote: GNU bash, version 4.2.39(1)-release (x86_64-redhat-linux-gnu) interprets this shell script differently when bash input comes from a terminal or when it conmes from a file: source(){ echo x } source In the former case it p

Re: umask --help

2014-07-07 Thread Chris F.A. Johnson
On Mon, 7 Jul 2014, Notes Jonny wrote: ... Would you consider adding a --help option for "umask" please? (I understand this is a built in command) Maybe also --version I was just hoping to find some help for it. "info umask" and "man umask" also don't say anything. help umask

Re: read-only flag is lost for functions in sub shells

2014-07-31 Thread Chris F.A. Johnson
lt; "$READONLY_VARS" readonly "${rov[@]}" fi foo=q ## not permitted -- Chris F.A. Johnson, <http://cfajohnson.com>

Re: Substring Expansion does not work as intended

2014-08-20 Thread Chris F.A. Johnson
Got: abcdef echo "${x: -2}" Or use a variable: o=-2 echo "${x:$o}" -- Chris F.A. Johnson, <http://cfajohnson.com>

Re: Bash-4.3 Official Patch 25

2014-09-24 Thread Chris F.A. Johnson
e ftp://ftp.cwru.edu/pub/bash site just has the main 4.3 file and 25 separate patches to merge. "A downloadable tar file of the current version with all official patches applied is available from savannah." <http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz>

Re: failure in pipeline not reflected in $?

2005-08-24 Thread Chris F.A. Johnson
tored in the PIPESTATUS array: $ false | true | false | true $ printf "%s\n" "[EMAIL PROTECTED]" 1 0 1 0 -- Chris F.A. Johnson <http://cfaj.freeshell.org> == Shell Scripting

Re: bash_profile ?

2005-09-16 Thread Chris F.A. Johnson
, as yours should be. If there are specific things you want to do, the best place to ask is in the comp.unix.shell newsgroup. -- Chris F.A. Johnson <http://cfaj.freeshell.org> == Shell Scr

Re: Bug in history using ctl-r

2005-10-01 Thread Chris F.A. Johnson
is a non-incremental search. This is not bound to any key by default. I have it bound to shift+up-arrow by putting this in my ~/.inputrc file: "\e[a": history-search-backward ## shift+up-arrow You could then type "m" and press shift+up-arro

Re: mod arithmetic result 0 gives error exit status

2005-10-10 Thread Chris F.A. Johnson
by 0 is trapped and flagged as an error." Implies otherwise. Thanks. Duane Ellis ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash -- Chris F.A. Johnson

Re: read built-in will not read inside while loop

2005-10-10 Thread Chris F.A. Johnson
ad a b c ; do echo $a read -p "Looping.. press a key." <--- This 'read' will not execute. To see what this command has read: echo REPLY=$REPLY echo $b echo $c done < <(ls -al ~/) exit 0 -- Chris F.A. Johnson <http://cfaj.freeshell

Re: Possible security bug - :: in PATH behaves as if it were "."

2005-10-17 Thread Chris F.A. Johnson
$verbose -ge 1 ] && echo "checkpath: $p is not a directory; removing it from PATH" >&2 fi done PATH=$newPATH return } _unslash() { _UNSLASH=$1 while : do case $_UNSLASH in ## remove trailing slashes */) _UNSL

Re: error in math args?

2005-11-30 Thread Chris F.A. Johnson
leading 0 are treated as octal, i.e. base 8; "8" and "9" are not legitimate octal digits. [EMAIL PROTECTED] complex]$ echo $(( 008 / 2 )) -bash: 008: value too great for base (error token is "008") -- Chris F.A. Johnson

Re: Alias and if

2005-12-04 Thread Chris F.A. Johnson
is reported on slightly different recent builds of Linux. #! /bin/bash Add: shopt -s expand_aliases if true; then alias myls=ls alias -p myls fi myls ############ -- Chris F.A. Johns

Re: Can create BASH functions that can't be deleted

2006-01-15 Thread Chris F.A. Johnson
can't be deleted. Repeat-By: function a.b() { echo My name is $FUNCNAME; } a.b My name is a.b unset a.b -bash: unset: `a.b': not a valid identifier unset -f a.b -- Chris F.A. Johnson <http://cfaj.freeshell.org> =

Re: [bash 3.1.5] sh -c "echo -n ok" broken

2006-01-18 Thread Chris F.A. Johnson
ault" as I need echo "ok\c" to work. The older bash-3.00.15(3) works with "--enable-xpg-echo-default". So, it is possible to have both the following working in "sh" and "bash" echo -n "ok" echo "ok\c" printf &qu

Re: Fwd: read -n is confused by \

2006-01-27 Thread Chris F.A. Johnson
variable". Presumably, without -r, the backslash is not considered a character, it is an escape mechanism. -- Chris F.A. Johnson <http://cfaj.freeshell.org> === Author: Shell Script

Re: Output redirection?

2006-01-29 Thread Chris F.A. Johnson
ot;$LOG_FILE" To redirect several commands, enclose them in braces: { echo "Today's date:" date } > "$LOG_FILE" The logfile is opened. If you want all succeeding output to go be redirected, use exec: exec > "$LOG_FILE" echo "

Re: incorrect brace expansion

2006-01-29 Thread Chris F.A. Johnson
the brace expansion should only happen when commas or sequence expressions are used, and while the inner braces used commads, the outer braces did not -mike Let's see... a-{b{d,e}}-c a-{bd,be}-c a-bd-c a-be-c It looks okey, I think. Except that b{d,e} expands to 'bd be&#

Re: make 'tr' (or something like it) a bash builtin ?

2006-02-02 Thread Chris F.A. Johnson
ilable at: <http://cfaj.freeshell.org/shell/bash/loadables/>. Second, is William Park's bash extension at: <http://home.eol.ca/~parkw/index.html#bash>. -- Chris F.A. Johnson <http://cfaj.freeshell.org>

Re: make 'tr' (or something like it) a bash builtin ?

2006-02-05 Thread Chris F.A. Johnson
first character Bar $ echo ${foo^^} ## Convert all characters BAR $ echo ${foo^[a-m]} ## Convert first character that matches pattern Bar $ echo ${foo^^[a-m]} ## Convert all characters that match pattern BAr -- Chris F.A. Johnson <ht

Re: command history

2006-02-24 Thread Chris F.A. Johnson
e[b": history-search-forward ## shift+down-arrow You may need to adjust the bindings for your terminal. -- Chris F.A. Johnson <http://cfaj.freeshell.org> === Author: Shell Script

Re: EOF does not work in echo

2006-05-25 Thread Chris F.A. Johnson
ter \004? It won't; it will print all characters. If it didn't, it would be of no use for concatenating binary files. -- Chris F.A. Johnson <http://cfaj.freeshell.org>

Re: (no subject)

2006-08-02 Thread Chris F.A. Johnson
o} Or, if you do not want to exit the script: [ -n "${FAKEVAR+X" ] || echo hello -- Chris F.A. Johnson <http://cfaj.freeshell.org> === Author:

Re: incorrect brace expansion when using default values

2006-09-06 Thread Chris F.A. Johnson
{1:-"a{b,c}"}" ; } $ foo ab ac However, there is a problem: $ foo 1 1 1 Where is the second '1' coming from? -- Chris F.A. Johnson <http://cfaj.freeshell.org>

Re: read 1 var in when executing command

2007-05-13 Thread Chris F.A. Johnson
t; > I would prefer, again, just to execute the command with the domain name > following Not sure how to do it. I have been looking around and saw > things like getopts, but I am only passing in one variable and thought it > should be fairly simple whois &qu

Re: Bash is broken

2007-05-13 Thread Chris F.A. Johnson
should not be capitalized.) To use '>' in a string comparison, either use the shell syntax [[ ... ]] or escape the '>': if [ "1" \> "2" ] if [[ "1" > "2" ]] -- Chris F.A. Johnson <http:/

Re: Generating unique file names

2007-05-13 Thread Chris F.A. Johnson
tarfile=wg-$date${n:--$n}.tgz while [ -f "$tarfile" ] do n=$(( ${n:=0} + 1 )) tarfile=wg-$date-$n.tgz done -- Chris F.A. Johnson <http://cfaj.freeshell.org> ==

Re: prefilling keyboard buffer

2007-06-16 Thread Chris F.A. Johnson
istory -s "$default" read -ep "Press up arrow to edit \"$default\": " XX -- Chris F.A. Johnson <http://cfaj.freeshell.org> === Author: Shell Scrip

Re: automate input

2007-08-09 Thread Chris F.A. Johnson
ot/$projectName initenv << CONFIRM > $'\r' > $'\r' > $svnRoot/$projectName > $'\r' > CONFIRM > ... yes "" | trac-admin $tracRoot/$projectName initenv -- Chris F.A. Johnson <http://cfaj.freeshell.org>

Re: Readline history and bash's read -e

2007-09-02 Thread Chris F.A. Johnson
d builtin? > > I wouldn't want to get the user's regular bash history; rather, this > program would need its own history file in the user's home directory. > For example: > > read -e --historyfile=~/.myprogname_history CMD history -r ~/.myprogname_history read -ep &

Re: bash root ~/.bash_profile quirk

2007-09-06 Thread Chris F.A. Johnson
g into root, PATH is there, LD_RUN_PATH is there, and > PKG_CONFIG_PATH is there, but not LD_LIBRARY_PATH (which makes some of my > programs not cooperate) Are you using "su" or "su -"? -- Chris F.A. Johnson <http://cfaj.freeshell.org>

Re: bash root ~/.bash_profile quirk

2007-09-06 Thread Chris F.A. Johnson
ms not cooperate) > >>>Are you using "su" or "su -"? > > I'm using just su... should I use "su -" ? If you use "su -", it does the equivalent of logging in, and thus reads .b

Re: Wrong input confuses bash's arithmetic unit permanently

2007-09-12 Thread Chris F.A. Johnson
'let' will generate bogus results. bash-3.1 returns > expected results. I agree that it is a bug, but it is one that will never bother me because I always use the POSIX arithmetic syntax: i=$(( $i + 1 )) What's the point of using let? -- Chris F.A. Johnson <http://cfaj.freeshell.org> === Author: Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) .

Re: reading whitespaces and beginning and end of line

2007-12-07 Thread Chris F.A. Johnson
a whitespace at the end of a > line in the input file, because this whitespace get automatically truncated > from "$line", and i dont want that..i want the whole line to go into > outfile, no matter if the last characters are whitespace! while IFS= read -r line do printf

Re: `read' builtin does not take last record without trailing delimiter

2008-02-26 Thread Chris F.A. Johnson
k an option should be present to turn on this > behavior for the builtin, because I can see some cases where > one *would* want the behavior as implemented as well. > > What do people think of this? I wouldn't use that method to populate an array. echo "0 1 2^3 4 5^6 7 8&

Re: Possible eval builtin speedup?

2008-03-05 Thread Chris F.A. Johnson
e is probably room for > a huge performance improvement in speeding up the eval builtin. > What do you think about it? Would it be a difficult task? It is more likely to be the command substitution that is slow. -- Chris F.A. Johnson, webmaster <http://Woodbine-Gerrard.com>

Re: Fwd: Problem with bash completion

2008-03-14 Thread Chris F.A. Johnson
-- tab after x now adds slash > > Once the shell starts doing this, it keeps doing it. Restarting bash > solves the problem. I don't see that problem, and I'm using the same version of bash. -- Chris F.A. Johnson, webmaster <http://Woodbine-Gerrard.

  1   2   3   >