multibyte chars, replacement works as expected. I looks like a
bug, or am I misssing something?
Regards,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de
, think it's a bug, as according to the docs, quote
removal should be performed on the words between [[ and ]].
Regards,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de
: ${HOSTNAME: bad substitution
Apparently bash interprets this as ${parameter/pattern/string}
where pattern = ${HOSTNAME. Looks like a bug; it works in ksh.
As a workaround, you could use:
H=${HOSTNAME/.*}
echo ${CLUSTER/$H}
Regards,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http
Chet Ramey schrieb:
Bernd Eggink wrote:
prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}}
output: -bash: ${HOSTNAME: bad substitution
Apparently bash interprets this as ${parameter/pattern/string}
where pattern = ${HOSTNAME. Looks like a bug; it works in ksh
) is unchanged.
Try this instead:
while read File
do
FileList[d]=$File
(( d=d+1 ))
done $(ls -1)
Greetings,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de
or
2.05b.0(1)-release?
Looks like there are at least 2 versions on your system: Your login
shell is probably bash-2.05b, while /opt/local/bin/bash (the latest
version) is found via $PATH. Check your account data and PATH setting to
verify it.
Regards,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http
Peter Volkov schrieb:
Better way to check if shell is login is:
$ shopt | grep login_shell
login_shell on
You don't even have to call an external program:
[[ $(shopt -p login_shell) == *-s* ]]
Regards,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de
-nothing'.
Regards,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de
makes the
example work.
Unpaired parens are hideous anyway, IMHO.
Regards,
Bernd
--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de
if [%w
570]; done results.txt
for i in $(find -name '*.gif')
do
w=$(identify -format %w $i)
(( w 570 )) echo $i $w
done
Hope that helps,
Bernd
--
Bernd Eggink
http://sudrala.de
are set.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
get the intended behaviour by putting
eval PS1='$PS1'
at the end of the function, but that's a rather ugly workaround.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
Chet Ramey schrieb:
Bernd Eggink wrote:
I normally wrap the builtin cd into a function cd, which does some
additional things and then calls the builtin. Example:
function cd
{
local list=$(echo *.bui)
# ...
builtin cd $1
}
I have a PS1 like this:
PS1=\\w
Chet Ramey schrieb:
Bernd Eggink wrote:
I'm still having problems with the cd builtin. In bash 3, the commands
cd
cd
both changed to the user's home directory. In bash 4 (with patch
save-current-token applied)
cd
does nothing. Bug or feature?
I get the same behavior from bash
.
Thanks for any help,
Duane
You have a wrong logic. This script will mkdir if it exists.
use
[ ! -d ${CommonDir} ]
Or use
mkdir -p $CommonDir
Bernd
--
Bernd Eggink
http://sudrala.de
-cmdexp.html
Maybe it is of use for you, too.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
, the shell still wants another
one. This variant works, however:
x=$(case $a in (1) echo one;esac
)
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
Chet Ramey schrieb:
Bernd Eggink wrote:
GNU bash, Version 4.0.17(1)-release (i686-pc-linux-gnu)
The shell doesn't recognize the closing parenthesis of a command
substitution if a 'case' command is included and 'esac' is preceded by
newline. Example:
x=$(case $a in
(1) echo one
esac
)
Try
with unallocated block argument
Abbruch...
Program received signal SIGABRT, Aborted.
0xe424 in __kernel_vsyscall ()
Appended is a stack trace. Hope it helps.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
malloc: hashlib.c:306: assertion botched
free: called with unallocated block argument
Chet Ramey schrieb:
Bernd Eggink wrote:
Version: GNU bash, Version 4.0.17(1)-release (i686-pc-linux-gnu)
(plus newline-shellmeta patch).
A script which uses, among other things, 3 associative arrays and a
coprocess, crashes reproducibly with an allocation error:
malloc: hashlib.c:306
[0m\]
This works correctly with bash 4.0.24.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
$list -- $zc
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
/ -iname $cur*.avi -type
f -printf %P\n)
local IFS=$'\n'
COMPREPLY=($files)
}
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
=: compgen -W $list))
}
complete -F _aha aha
Typing aha Tab cycles through 6 items a, b, c, d, e, f, whereas I
would expect 3 items 'a b', 'c d', 'e f'. It looks like compgen splits
the argument to -W on $IFS _and_ whitespace. Or am I missing something?
Regards,
Bernd
--
Bernd Eggink
http
'). I'd also rather use printf
%P\n (capital P) instead of %p, the results look nicer (IMHO).
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
GNU bash, version 4.0.35(1)-release (i686-pc-linux-gnu)
The following syntactically wrong declaration causes a segmentation fault:
declare -A x=y
It should issue an error message instead.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
Am 26.11.2009 01:47, schrieb Chet Ramey:
Bernd Eggink wrote:
GNU bash, version 4.0.35(1)-release (i686-pc-linux-gnu)
The following syntactically wrong declaration causes a segmentation fault:
declare -A x=y
It should issue an error message instead.
It's not actually a syntax error
--
Bernd Eggink
http://sudrala.de
, and local are
synonyms. Using 'local' outside a function is an error, so IMHO this
command is completely redundant. It _would_ make some sense, however, if
its counterpart 'global' existed, as it could help clarify the intended
usage of the variable.
Bernd
--
Bernd Eggink
http://sudrala.de
second that. I'm missing this feature badly. Presently, you can only
get around this restriction by using a lot of ugly and dangerous 'eval's.
Bernd
--
Bernd Eggink
http://sudrala.de
Am 12.12.2009 11:24, schrieb Bernd Eggink:
Am 12.12.2009 02:11, schrieb Matthew Woehlke:
konsolebox wrote:
I hope the development team will also consider adding a way in bash to
declare global variables inside a function perhaps either with an
option in typeset or declare like -g (same as zsh
Am 12.12.2009 21:41, schrieb Chet Ramey:
On 12/12/09 5:28 AM, Bernd Eggink wrote:
Am 10.12.2009 10:40, schrieb konsolebox:
I hope the development team will also consider adding a way in bash to
declare global variables inside a function perhaps either with an
option in typeset or declare like
Am 12/14/09 13:37, schrieb Marc Herbert:
Bernd Eggink a écrit :
To avoid misunderstandings, let me add that you are right (only) with
respect to variables being used _without_ declaration.
OK, but not having to explicitly declare variables is a feature that
most people expect from dynamic
Am 12.02.2010 15:39, schrieb Greg Wooledge:
On Fri, Feb 12, 2010 at 02:53:39PM +0100, Bernd Eggink wrote:
I once wrote a more generic shell function for this purpose, see:
http://sudrala.de/en_d/shell-getlink.html
You note that it doesn't handle names containing -, which is true.
I'll get
that first element of array1[0]=a and for
example third element of array3[2]=c. This is the way how I do it :
for (( n=1; n4; n++ ))
do
array$n=(a b c)
done
...but there is syntax error
That's because array$n isn't a valid name. Use eval:
eval array$n=(a b c)
Bernd
--
Bernd Eggink
}; do :; done# wrong
select x in amö blah{1..20}; do :; done # OK
Bash version is 4.1.7(1)-release, LANG is de_DE.UTF-8.
Bernd
--
Bernd Eggink
http://sudrala.de
, for
example.
Bernd
--
Bernd Eggink
http://sudrala.de
() compound-command [redirection]
and do not see the version you show without the parens.
It's there. Look at the 3rd sentence:
If the function reserved word is supplied, the parentheses are
optional.
Bernd
--
Bernd Eggink
http://sudrala.de
between passing all
elements to a function, which is time-consuming, or using eval, which is
cumbersome and error-prone.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
, monday, tuesday, since you
left out the ++ in the first term.
I think the problem is that the ,, operator causes each expression to be
evaluated twice. That would explain this behaviour, and it's a bug IMHO.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
functions f1, f2, and f3. The first call to any of these functions will
replace its definition by the one found in $FUNCDIR, and also call the
latter.
I'm not sure, however, if this is guaranteed to work in any case (and in
any bash version).
Greetings,
Bernd
--
Bernd Eggink
http://sudrala.de
Am 02.08.2010 19:15, schrieb Andreas Schwab:
Bernd Egginkmono...@sudrala.de writes:
eval function $name
Don't use function, use $name () instead.
What's wrong with function??
Bernd
--
Bernd Eggink
http://sudrala.de
Am 02.08.2010 20:16, schrieb Eric Blake:
On 08/02/2010 12:15 PM, Bernd Eggink wrote:
Am 02.08.2010 19:15, schrieb Andreas Schwab:
Bernd Egginkmono...@sudrala.de writes:
eval function $name
Don't use function, use $name () instead.
What's wrong with function??
'function name
if has an alias. Therefore 'foo' in your function
declaration is replaced by 'echo this is the alias'. Unfortunately, you
can't quote the function name in the declaration, so you have to either
use 'function' or say unalias foo first.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
://www.chiark.greenend.org.uk/~sgtatham/aliases.html
Interesting article. One thing not mentioned there is declarations.
alias assoc='declare -A '
assoc x y z
Not particularly useful, but you can't replace that with a function (as
long as there is no 'global' option for declare).
Bernd
--
Bernd Eggink
http
definition.
I suppose that is just a documentation issue. Can anybody comment on this?
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
, as opposed to
0.2 seconds with 4.1-9. Counting from 1 to 1 is about 20 times
slower. Maybe due to heavy debugging?
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
On 09.08.2011 03:44, Jon Seymour wrote:
Has anyone ever come across an equivalent to Linux's readlink -f that
is implemented purely in bash?
You can find my version here:
http://sudrala.de/en_d/shell-getlink.html
As it contains some corrections from Greg Wooledge, it should handle
On 09.08.2011 15:50, Steven W. Orr wrote:
On 8/9/2011 5:29 AM, Bernd Eggink wrote:
On 09.08.2011 03:44, Jon Seymour wrote:
Has anyone ever come across an equivalent to Linux's readlink -f
that is implemented purely in bash?
You can find my version here:
http://sudrala.de/en_d/shell
On 09.08.2011 16:54, Stephane CHAZELAS wrote:
2011-08-09, 09:50(-04), Steven W. Orr:
[...]
*) To remove the trailing slashes, instead of
while [[ $file == */ ]]
do
file=${file%/}
done
file=${file##*/}# file name
On 11.02.2013 18:50, Dashing wrote:
Bash version: 4.2.042
I have a script that behaves erratically:
=
#! /bin/bash
last=${1##* }
rest=${1% *}
while [[ ${rest: -1} == '\' ]]; do
last=${rest##* } $last
oldrest=$rest
rest=${rest% *}
if [[ $oldrest == $rest
On 12.02.2013 18:50, Dashing wrote:
On Tue, 12 Feb 2013 18:02:05 +0100 Chet Ramey
I've fixed the problem, and the fix will be in the next release.
Thank you, Chet!
On Tue, 12 Feb 2013 10:13:46 +0100 Bernd Eggink
superfluous blank in the ${rest: -1} expression
Bernd, this blank makes a big
53 matches
Mail list logo