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
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
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
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
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
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/
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)
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
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)
.
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)
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
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
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
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
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)
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
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)
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
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
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
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
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>
==
? 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
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)
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
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)
"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)
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)
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.
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
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
:
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)
-- 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.
--
))
--
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)
=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/&
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
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)
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
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
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
$@" ... 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)
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
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)
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
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
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)
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;
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;
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
== $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
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
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)
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
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
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
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
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
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"
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
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
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
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/>
oami`@`hostname`'
--
Chris F.A. Johnson, <http://cfajohnson.com>
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
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
lt; "$READONLY_VARS"
readonly "${rov[@]}"
fi
foo=q ## not permitted
--
Chris F.A. Johnson, <http://cfajohnson.com>
Got: abcdef
echo "${x: -2}"
Or use a variable:
o=-2
echo "${x:$o}"
--
Chris F.A. Johnson, <http://cfajohnson.com>
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>
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
, 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
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
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
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
$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
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
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
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>
=
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
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
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 "
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
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>
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
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
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>
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:
{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>
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
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:/
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>
==
istory -s "$default"
read -ep "Press up arrow to edit \"$default\": " XX
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===
Author:
Shell Scrip
ot/$projectName initenv << CONFIRM
> $'\r'
> $'\r'
> $svnRoot/$projectName
> $'\r'
> CONFIRM
> ...
yes "" | trac-admin $tracRoot/$projectName initenv
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
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 &
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>
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
'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)
.
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
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&
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>
-- 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 - 100 of 235 matches
Mail list logo