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 what I meant
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
r
Aborting...ABORT instruction (core dumped)
--
I get:
'123' in '123 text!'
(bash 5.1 in mate-terminal)
--
Chris F.A. Johnson <http://cfajohnson.com/>
(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-Solution Approach (2005, Apress)
Pro B
use button to position the
cursor.
https://cfajohnson.com/shell/?2005-07-15_mousetraps
--
Chris F.A. Johnson <http://cfajohnson.com/>
=== Author: ===
Shell Scripting Recipes: A Problem-Solution Approa
style definition macros. Variables
become extremely identifiable and comprehensible.
A text editor, such as emacs in Bash mode, can highlight variables. No
need to use any sort of naming convention.
--
Chris F.A. Johnson <http://cfajohnson.
tegar only.)
This is just wrong. `local' accepts the same option set as `declare'.
There are other things wrong in that book as well; the description of
printf, for example.
Don't use it as an authority on bash.
--
Chris F.A. Johnson <http://c
On Wed, 29 Jan 2020, Greg Wooledge wrote:
As long as you use at least one lowercase letter in your variable name,
you are guaranteed not to conflict with any internal shell variables.
Except for auto_resume and histchars.
--
Chris F.A. Johnson <h
page as such.
$ type in
in is a shell keyword
--
Chris F.A. Johnson <http://cfajohnson.com/>
=== Author: ===
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Progr
installed.
--
Chris F.A. Johnson, <http://cfajohnson.com>
On Fri, 9 Jun 2017, L A Walsh wrote:
Chris F.A. Johnson wrote:
On Fri, 9 Jun 2017, L A Walsh wrote:
First problem: If you are assigning a string to a variable,
you need to put quotes around the string.
You don't need to quote it unless it contains literal whitespace.
Not exactly
On Fri, 9 Jun 2017, L A Walsh wrote:
Chris F.A. Johnson wrote:
On Fri, 9 Jun 2017, L A Walsh wrote:
First problem: If you are assigning a string to a variable,
you need to put quotes around the string.
You don't need to quote it unless it contains literal whitespace.
Not exactly
On Fri, 9 Jun 2017, L A Walsh wrote:
First problem: If you are assigning a string to a variable,
you need to put quotes around the string.
You don't need to quote it unless it contains literal whitespace.
--
Chris F.A. Johnson, <http://cfajohnson.com>
call
--
Chris F.A. Johnson, <http://cfajohnson.com>
On Sun, 30 Oct 2016, Tim Rühsen wrote:
...
Since cat and rm implementations are pretty small in code size, I wonder if
you (the maintainers) would accept patches to make these commands builtin
commands.
Have you looked at the loadable builtins in the examples directory?
--
Chris F.A
On Wed, 13 Jul 2016, Chet Ramey wrote:
On 7/13/16 10:58 AM, Chet Ramey wrote:
On 7/13/16 10:49 AM, Chris F.A. Johnson wrote:
On Tue, 12 Jul 2016, Chet Ramey wrote:
The second beta release of bash-4.4 is now available with the URL
ftp://ftp.cwru.edu/pub/bash/bash-4.4-beta2.tar.gz
I get
=> TYPE I ... done. ==> CWD (1) /pub/bash ... done.
==> SIZE bash-4.4-beta2.tar.gz ... 8932859
==> PASV ...
--
Chris F.A. Johnson, <http://cfajohnson.com>
with the proposed new logo designs where you can
vote for your favorite:
http://goo.gl/forms/qjohwvtgys
I chose no. 2, but I would like it better with the colours reversed.
--
Chris F.A. Johnson, <http://cfajohnson.com>
essary) and RET.
--
Chris F.A. Johnson, <http://cfajohnson.com>
On Sun, 18 Oct 2015, 積丹尼 Dan Jacobson wrote:
"CFAJ" == Chris F A Johnson <ch...@cfajohnson.com> writes:
CFAJ> Or just press UP (as many times as necessary) and RET.
That won't get me to a $ prompt.
I want to suspend my search and resume it later.
^Z then fg
--
Chris
a usage where it expands to a filename and
is treated as such.
Try this:
echo <(cat /etc/passwd)
--
Chris F.A. Johnson, <http://cfajohnson.com>
with multiple jobs.
$ bash --norc
bash-4.3$ sleep 1 sleep 2 wait -n
[1] 8368
[2] 8369
[1]- Donesleep 1
bash-4.3$ ^C*** stack smashing detected ***: bash terminated
I have no problem running that line, and ^C still works.
--
Chris F.A. Johnson, http://cfajohnson.com
of duck.jpg will be interpreted
as 4 files an image of duck.jpg
Yes, it does.
Your problem is (probably, since you didn't include an example) that
you omitted quotes around its expansion, e.g.:
printf '%s\n' $file
That should be:
printf '%s\n' $file
Repeat-By:
--
Chris F.A. Johnson
$nl '$1 ; }
ord $(printf \n)
Trailing newline are stripped from command substitution, making $(printf
\n) and empty string.
If you want a newline, use:
ord $'\n'
--
Chris F.A. Johnson, http://cfajohnson.com
dash handle either
case correctly:
Neither pdksh nor dash has brace expansion.
--
Chris F.A. Johnson, http://cfajohnson.com
in yes) echo yes; ;; no)
echo no; ;; esac)'
It does work with bash 4.x.
Is this a known issue with 3.2 or is it particular to the OSX
implementation (which in my case is 3.2.53(1))?
Balance the parentheses:
echo $(case yes in (yes) echo yes; ;; (no) echo no; ;; esac)
--
Chris F.A. Johnson
://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
--
Chris F.A. Johnson
a variable:
o=-2
echo ${x:$o}
--
Chris F.A. Johnson, http://cfajohnson.com
readonly ${rov[@]}
fi
foo=q ## not permitted
--
Chris F.A. Johnson, http://cfajohnson.com
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
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
`'
--
Chris F.A. Johnson, http://cfajohnson.com
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/
, that 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 Recipes: A Problem-Solution Approach (2005, Apress)
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. Johnson, http://cfajohnson.com/
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem
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 ch...@cfajohnson.com wrote:
On Mon, 10 Jun 2013, Greg Wooledge wrote:
On Sun, Jun 09
On Mon, 10 Jun 2013, Greg Wooledge wrote:
On 10 Jun 2013 14:15, Chris F.A. Johnson ch...@cfajohnson.com 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 command execution
of bash i tried fails this way (2.05b through 4.2.45)
With 4.2.37:
func ()
{
cat / EOF ||
11
EOF
echo FAIL
}
--
Chris F.A. Johnson, http://cfajohnson.com/
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution
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 GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem
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
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, Pierre Gaston wrote:
On Wed, Apr 3, 2013 at 11:33 AM, Chris F.A. Johnson ch...@cfajohnson.comwrote:
On Wed, 3 Apr 2013, Pierre Gaston wrote:
On Wed, Apr 3, 2013 at 11:03 AM, Chris Down ch...@chrisdown.name wrote:
On 2013-04-03 11:00, Nikolai Kondrashov wrote
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 POSIX-compliant manner
On Wed, 30 Jan 2013, Andreas Schwab wrote:
Chris F.A. Johnson ch...@cfajohnson.com 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
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 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 the GNU/Linux
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/
Author:
Pro Bash
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/
Author:
Pro Bash Programming: Scripting
:
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)
=($@); 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 Shell (2009, Apress)
Shell Scripting
=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/
Author:
Pro Bash
to
it -- 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
:
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)
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
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)
$ ./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. Johnson, http://cfajohnson.com/
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell
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 receive abc
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)
version of bash?
I can confirm it on 3.05b, 3.0 and 4.2:
while [ ${n:=0} -lt 5 ]
do
seTAB
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 Problem-Solution
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
===
Author:
Shell
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 Shell (2009, Apress)
Shell Scripting Recipes: A Problem
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://cfajohnson.com/
Author:
Pro Bash Programming: Scripting the GNU/Linux
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/Linux Shell (2009
^[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: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem
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 (2009, Apress)
Shell
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: Scripting the GNU/Linux
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 option-name] [arg
.
--
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)
at 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)
.
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 parsed before IFS is set.
--
Chris F.A. Johnson, http://cfajohnson.com
Author:
Pro Bash Programming
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/Linux Shell
-asus plugins]$ declare -A foo=( $(func) )
$ declare -A foo=('[a]=5')
Drop the qotes:
declare -A foo=( [a]=5 )
bash: foo: [a]=5: must use subscript when assigning associative array
$ eval declare -A foo=($(echo '[a]=5')); echo ${foo[a]}
5
--
Chris F.A. Johnson, http://cfajohnson.com
differ
Aborting...
Repeat-By: typing cd '\ or ls \ will reproduce the above bug
Using: GNU bash, version 4.1.7(2)-release (amd64-portbld-freebsd8.1)
does not seem to produce that error.
Nor does 4.0.28(2)-release on Mandriva 2009.1.
--
Chris F.A. Johnson, http://cfajohnson.com
might put it in a script, expecting to be prompted, and lose
files you need. Aliases are not expanded in a script.
--
Chris F.A. Johnson, http://cfajohnson.com
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution
On Sun, 26 Sep 2010, Christopher Roy Bratusek wrote:
btw. How can I remove the last arguement ${!#} ?
I tried args=${@:-${!#}} but that won't work.
args=( $@ )
unset args[$#-1]
set -- ${ar...@]}
--
Chris F.A. Johnson, http://cfajohnson.com
Author:
Pro Bash Programming: Scripting
characters such as space by adding '\' in front them?
This will supply as many files as possible as arguments to stat:
find . -type f -exec stat --printf %y %n\n +
--
Chris F.A. Johnson, http://cfajohnson.com
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress
advantage over standard syntax.
[[ ... ]] is not standard, and offers little over the standard
syntax.
--
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
.
--
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)
is negligible compared to
portability.
It makes it clear that you are no longer doing what I want, a multi-variable
assignment.
It *is* a multi-variable assignment.
But that's my sense of what looks readable in codeYMMV.
On 8/2/2010 3:51 PM, Chris F.A. Johnson wrote:
On Mon, 2
like such a basic concept. Sorry, this newbie
needs help on such trivial matters. :-(
When quoted, the right-hand argument is matched as a string, not an
expression.
--
Chris F.A. Johnson, http://cfajohnson.com
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009
for this are in the last chapter of my first
book, Shell Scripting Recipes.)
--
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)
of
the parent (main) shell you use.
Then what's the problem with my script in my original mail? Seems like Bash
does not handle the signal in a real-time way.
The special variable $$ refers to the current process, even if it
has the same numeric value as the parent script.
--
Chris F.A
On Wed, 30 Jun 2010, Clark J. Wang wrote:
On Wed, Jun 30, 2010 at 12:38 PM, Chris F.A. Johnson
ch...@cfajohnson.comwrote:
On Wed, 30 Jun 2010, Clark J. Wang wrote:
I have a bash script like this:
#!/bin/bash
trap 'echo killed by SIGALRM; exit 1' ALRM
function
e
f
g
--
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)
from 'declare'
being a duplicate of the (non-standard) typeset builtin.
If would be much more useful (and semantically accurate), if it
just did what its name implies, and left the 'local' builtin for
declaring variable local to a function.
--
Chris F.A. Johnson, http://cfajohnson.com
.
Since pwd is a shell command, when /bin/pwd is actually used? In
shells that don't have built-in pwd?
And all POSIX shells have the $PWD variable.
--
Chris F.A. Johnson, http://cfajohnson.com
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell
name: / and NUL.
--
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)
'/mandriva/,/fi;}/p');
content=$(echo $content | sed '/^\s*urpmi[:space:]--auto/p');
--
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)
or directory
In such situations I find completion (TAB) really great since it does
the hard quoting work for you (and does no typo).
That, or up-arrow (or Ctrl-P) to recall previous command.
--
Chris F.A. Johnson, http://cfajohnson.com
Author:
Pro Bash Programming: Scripting
Version: 4.0
Patch Level: 33
Release Status: release
Description:
Typing 'declare -A a=b' crashes bash with a segmentation fault.
Repeat-By:
Type 'declare -A a=b'.
I can confirm that in 4.0, but it works in 4.1
Time to upgrade?
--
Chris F.A. Johnson, http
On Fri, 9 Apr 2010, Greg Wooledge wrote:
On Fri, Apr 09, 2010 at 11:59:20AM -0400, Chris F.A. Johnson wrote:
On Fri, 9 Apr 2010, Marc Herbert wrote:
Le 08/04/2010 22:58, Peng Yu a ?crit :
$ mkdir environment\\-
$ cd environmen\\-
-bash: cd: environmen-: No such file
: The $? variable is always 0 after that statement.
The return status is that of the command, local.
--
Chris F.A. Johnson http://cfajohnson.com
===
Author:
Shell Scripting Recipes: A Problem-Solution Approach
in a
subshell.
--
Chris F.A. Johnson http://cfajohnson.com
===
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009
substitution,
$(date +'%Y-%m-%d'), should be treated as a single word.
Yes, it is a single word.
But it is subject to wordsplitting:
$ print %s\n $(date +'%Y %m %d')
2010
02
23
--
Chris F.A. Johnson http://cfajohnson.com
path to the file, so: ${0%/*}
--
Chris F.A. Johnson http://cfajohnson.com
===
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU
On Thu, 11 Feb 2010, Eric Blake wrote:
According to Chris F.A. Johnson on 2/11/2010 4:23 PM:
On Fri, 12 Feb 2010, Peng Yu wrote:
$0 gives the file name of the script. I could use several shell
command to get the directory where the script is in. But I'm wondering
if there is an easy
. It is used like this-
myIpExec {IPaddr1} ${IPaddr2} ${IPaddr3} ${IPaddr4}
Result=$?
The portable equivalent is:
myIpExec EOF
{IPaddr1} ${IPaddr2} ${IPaddr3} ${IPaddr4}
EOF
--
Chris F.A. Johnson http://cfajohnson.com
1 - 100 of 193 matches
Mail list logo