On Wed, Apr 04, 2012 at 04:08:04PM -0700, Linda Walsh wrote:
> function ll { ls -l "$@"}
Just for the record, a one-line function definition requires a ; before
the closing curly brace.
ll() { ls -l "$@";}
On Wed, Apr 11, 2012 at 02:34:01AM -0700, Linda Walsh wrote:
> - for ((vl=$((v_level - 1)); $vl > 0; --vl))
The inside of the for ((...)) is already a math context. You don't need
another $((...)) inside it.
for ((vl = v_level - 1; vl > 0; --vl))
Or is that another "irrelevant detail"?
"declare" when used in a function acts like "local", and creates a variable
with scope local to that function. So does "declare -r". But "readonly",
which is otherwise the same as "declare -r", creates variables with global
scope.
Is this intended?
Tested with 2.05b, 3.something, and 4.2.20.
On Fri, Apr 20, 2012 at 10:38:24AM -0400, Steven W. Orr wrote:
> (I hope people are still reading...)
You'd get a better response on the help-bash mailing list, since you
are not reporting a bug.
On Mon, Apr 23, 2012 at 02:38:47PM +0400, Andrey Zaitsev wrote:
> Strace show that errors from /bin/bash were ignored:
>
> [user@host ~]# strace echo "bla-bla-bla" > /mnt/fs/out.txt
> execve("/bin/echo", ["echo", "bla-bla-bla"], [/* 22 vars */]) = 0
If you want an strace of the internal echo, you
On Mon, Apr 23, 2012 at 06:50:31PM +0200, Andreas Schwab wrote:
> The redirection itself won't fail, unless the device is out of inodes.
Ah... OK, I can see how that might be the case. Or depending on the
file system implementation, it might fail if an additional block of
disk space would need to
On Wed, Apr 25, 2012 at 08:40:11AM -0400, Chet Ramey wrote:
> Since you're using bash-4.2, you can experiment with the `lastpipe' shopt
> option. If that's enabled, bash runs the last element of a pipeline in
> the parent shell context without creating a subshell.
I actually started writing a res
On Wed, Apr 25, 2012 at 11:07:57AM -0400, Chet Ramey wrote:
> z4.local(1)$ ../bash-4.2-patched/bash -c 'echo $BASH_VERSION'
> 4.2.24(9)-release
> z4.local(1)$ ../bash-4.2-patched/bash ./x3
> foo
> z4.local(1)$ ./x3
> foo
I grabbed patches 21-24 and applied them. No change.
imadev:/var/tmp/bash/b
On Wed, Apr 25, 2012 at 06:26:18PM +0200, Roman Rakus wrote:
> On 04/25/2012 06:15 PM, Chet Ramey wrote:
> >OK. I get the same working behavior on Mac OS X, Solaris 8/10, RHEL 5,
> >BSD/OS (old), and Fedora 15. I'm not sure what to tell you.
> On Fedora 16 it works as expected.
> $ rpm -q bash
>
On Wed, Apr 25, 2012 at 12:55:06PM -0400, Greg Wooledge wrote:
> It also fails on OpenBSD 5.0 using bash 4.2.10 from ports.
And it also fails on OpenBSD 5.0 using bash 4.2.24 straight from the
original sources.
cyclops:/var/tmp/bash/bash-4.2$ ./bash -c 'echo $BASH_VERSION'
4.2.
On Wed, Apr 25, 2012 at 10:36:53AM -0700, Ted Okuzumi wrote:
> Please note that if I use a different command in the while loop it works.
>
> So instead of
> echo "$mydata" | while read -r line; do myarray+=( "$line" ); done
>
> if I say:
> echo "$mydata" | while read -r line; do echo "$line" ; do
On Wed, Apr 25, 2012 at 01:31:11PM -0400, Chet Ramey wrote:
> OK. Maybe someone with OpenBSD can debug the appropriate code in
> execute_cmd.c:execute_pipeline. Maybe the call to move_to_high_fd
> fails.
Breakpoint 1 at 0x41d5fc: file execute_cmd.c, line 2107.
Breakpoint 2 at 0x414aa3: file gene
On Wed, Apr 25, 2012 at 02:54:07PM -0400, Chet Ramey wrote:
> On 4/25/12 2:04 PM, Greg Wooledge wrote:
>
> > Maybe it only works on boxes with a very large "open files" resource
> > limit. Perhaps the hard-coded 255 should be replaced with something
> > involv
On Wed, Apr 25, 2012 at 04:05:15PM -0400, Chet Ramey wrote:
> OK. Now make the call move_to_high_fd(0, 1, -1) and see if that fixes it.
cyclops:/var/tmp/bash/bash-4.2$ ./bash ~/foo
cyclops:/var/tmp/bash/bash-4.2$ ./bash -c 'shopt -s lastpipe; echo hi | read
f
On Wed, Apr 25, 2012 at 04:46:02PM -0700, Linda Walsh wrote:
> I would guess (without looking at the codE), that
> when you do a local, it creates another copy of 'var' at the end of an
> array.
> like var[0][1]
> so global is at 0, and local is at 1.
I'm pretty sure bash doesn't use a multidimen
On Mon, Apr 23, 2012 at 04:56:09PM +0800, Clark Wang wrote:
> When I revisit this 2 years old thread I don't understand why following
> foo() function does not output the global var:
>
> $ cat foo.sh
> var=global
> foo()
> {
> local var=foo
> unset var
> echo foo: $var
> }
> bar_unset(
On Thu, Apr 26, 2012 at 05:54:27PM +0200, Maarten Billemont wrote:
> On 26 Apr 2012, at 01:18, Linda Walsh wrote:
> >
> > Ishtar:> echo "${b[*]}"
>
> You should always recommend the "${b[@]}" variant. "${b[*]}" is rarely
> useful in the event that your intent is to merge the array into a single
On Thu, Apr 26, 2012 at 12:02:20PM -0600, Bill Gradwohl wrote:
> bar_unset() {
> unset var
> echo ${FUNCNAME[@]}: $var
> displayVar
> displayVarbar_unset() {
>echo ${FUNCNAME[@]}: $var
> }
> displayVarbar_unset
> echo
> newVar=bar_unset
> }
> When newVar is
On Thu, Apr 26, 2012 at 01:37:57PM -0600, Bill Gradwohl wrote:
> When the child creates a global to pass back information, and then
> terminates, the parent had no control over that variables creation and is
> now stuck with something in the global name space that via the hierarchy of
> calls, it d
On Thu, Apr 26, 2012 at 08:47:39PM -0700, Linda Walsh wrote:
> Obviously, they were not complete beginners to bash -- to be
> reading
> arrays in from vars holding multi-line text? I would assume they'd have
> the
> intelligence to know when to use * or @ and I wouldn't have to talk down to
>
On Mon, Apr 30, 2012 at 09:57:16AM -0400, Chet Ramey wrote:
> Bash reads 128 characters at a time and uses lseek to move the file pointer
> back to the last character `read' consumes. The negative offset to lseek
> causes some kind of problem, but it doesn't return an error. When bash
> goes back
On Thu, May 03, 2012 at 02:34:16PM +0800, Pan ruochen wrote:
> $i=0; ((i++)); echo $?
> And the result is
> 1
Which means it's supported.
> which means an error.
http://mywiki.wooledge.org/BashFAQ/105
> Yours, Rüdiger.
> a=x
> del="$(echo -e "\\x7f")"
>
> echo "$del${a#x}" | od -ta
> echo "$del ${a#x}" | od -ta
> echo " $del${a#x}" | od -ta
Yup, confirmed that it breaks here, and only when the # parameter expansion
is included.
imadev:~$ del=$'\x7f' a=x b=
imadev:~$ echo " $del$b" | od -ta
0
On Thu, May 03, 2012 at 08:45:57PM +0100, Colin McEwan wrote:
> My contention is that this is the sort of thing that more people will want to
> do more frequently, and that this is a reasonable argument in favour of
> including the functionality *correctly* in the core language for maximum
> expres
On Thu, May 03, 2012 at 10:12:17PM +0200, John Kearney wrote:
> function runJobParrell {
> local mjobCnt=${1} && shift
> jcnt=0
> function WrapJob {
> "${@}"
> kill -s USR2 $$
> }
> function JobFinised {
> jcnt=$((${jcn
On Fri, May 04, 2012 at 12:41:03PM -0400, Mike Frysinger wrote:
> i wish there was a way to use `wait` that didn't block until all the pids
> returned. maybe a dedicated option, or a shopt to enable this, or a new
> command.
wait takes arguments.
> for example, if i launched 10 jobs in the bac
On Fri, May 04, 2012 at 09:02:27PM +0200, John Kearney wrote:
> set -m
> cnt=0
> trap ': $(( --cnt ))' SIGCHLD
> set -- {0..20}
> while [ $# -gt 0 ]; do
> if [[ ${cnt} -lt 10 ]] ; then
>
> (
> d=$(( RANDOM % 10 ))
> echo $n sleeping $
On Fri, May 11, 2012 at 11:57:33PM +0200, Ole Tange wrote:
> Example from the man page:
>
>Run one gzip process per CPU core. Block until a CPU core
> becomes available.
>
> for i in `ls *.log` ; do
>echo $i
>sem -j+0 gzip $i ";" echo done
> done
>
same sorting from both ls and *.
For instance, on HP-UX 10.20, in the en_US.iso88591 locale:
imadev:~$ mkdir /tmp/greg && cd "$_"
imadev:/tmp/greg$ touch a A á Á à À â Â ä Ä b B
imadev:/tmp/greg$ ls
A a Á á À à Â â Ä ä B b
imadev:/tmp/greg$ echo *
A a Á á À à Â â Ä ä B
On Mon, May 21, 2012 at 12:19:26PM -0700, Linda Walsh wrote:
> Greg Wooledge wrote:
> >For instance, on HP-UX 10.20, in the en_US.iso88591 locale:
> >A a ... B b
> >Meanwhile, on Debian 6.0, in the en_US.iso88591 locale:
> >a A ... b B
> So wh
On Tue, May 22, 2012 at 04:47:01AM -0700, Linda Walsh wrote:
> If you are in your trap handler, and you don't reset the signal --
> how can you guarantee that your signal handler will be reset
> before another even that would cause a trap occurs
You are using the wrong words for everything.
A sig
On Tue, May 29, 2012 at 09:25:02PM -0600, Bill Gradwohl wrote:
> I have no idea what the wget's are supposed to be doing, but here's a
> function that will compare 2 foreign arrays and return true 0 or false 1.
>
> compareForeignArrays(){
>## $1 and $2 are the names of the arrays to compare.
>
On Wed, May 30, 2012 at 10:14:42AM -0600, Bill Gradwohl wrote:
> What say you Chet? Bug or feature? There is no middle ground.
That's unrealistic. There are plenty of things that occupy that middle
ground -- unexpected program behaviors. The programmer can never
anticipate *every* input sequence
On Fri, Jun 01, 2012 at 10:53:22AM +0200, freD wrote:
> bash-3.00# T=toto ; du | while read a ; do T=$a ; done ; echo $T
> toto
http://mywiki.wooledge.org/BashFAQ/024
Quick answer: while read ... done < <(some command)
Portable version: mkfifo fifo; some command > fifo & ...
On Fri, Jun 01, 2012 at 04:39:08PM -0700, rac8006 wrote:
>
> What is the proper way to add popd pushd dirs etc to bash. When I currently
> build bash these
> are missing. I also get an error libintl_ngettext undefined reference. I
> can get around this error
> by adding -lintl to the link. Jus
On Mon, Jun 18, 2012 at 02:19:41PM +0100, Jacobo de Vera wrote:
> Subject: Re: Arrays declared global in function and initialised in same line
> are not visible outside of function
I can't reproduce that problem:
imadev:~$ unset a; f() { declare -ga a=(1 2); }; f; declare -p a
declare -a a='([0
On Fri, Jul 13, 2012 at 08:53:25AM +0300, Pierre Gaston wrote:
> On Thu, Jul 12, 2012 at 8:09 PM, Ernesto Messina
> wrote:
> > Hello, I think I found an overflow bug. I got the follow C program:
> >
> > #include
> > #include
> >
> > int main(int argc, char *argv[])
> > {
> > char a[10];
> >
On Mon, Jul 16, 2012 at 02:13:48PM -0500, Kevin Low wrote:
> "In addition, the C-x C-r command re-reads this init file, thus
> incorporating any changes that you might have made to it."
Many of readline's functions are not bound in vi mode.
$ set -o emacs
$ bind -p | grep C-x | grep C-r
"\C-x\C-r
On Tue, Jul 24, 2012 at 05:03:36PM +0200, michael.haubenwall...@salomon.at
wrote:
> Description:
> On AIX (5.3, 6.1, 7.1), as well as on Interix (any version) I do
> encounter
> some race condition in a code similar to:
> if grep "unwanted" /some/nonexistent/filename
>
On Wed, Jul 25, 2012 at 09:59:28AM +0200, Michael Haubenwallner wrote:
> OTOH, AFAICT, as long as a PID isn't waitpid()ed for, it isn't reused by
> fork().
> However, I'm unable to find that in the POSIX spec.
A process that hasn't been waited for should become a zombie, which
should be sufficien
On Thu, Jul 26, 2012 at 02:48:30AM -0700, wangzhong@gmail.com wrote:
> Hi all,
>
> I'm not sure whether I should post this here. Sorry if disturb.
help-bash would be a better choice than bug-bash.
> We met a very strange problem with bash "version 3.00.15(1)-release". We are
> using a hadoop
On Sun, Jul 29, 2012 at 03:04:21PM -0400, Chris F.A. Johnson wrote:
> On Sun, 29 Jul 2012, Jason Vas Dias wrote:
> >function count_args {v=($@); echo ${#v[@]}; }
>
>Always quote $@. Without quotes, it's the same as $*
>
> function count_args {v=( "
On Tue, Jul 31, 2012 at 12:12:42AM +0800, jida...@jidanni.org wrote:
> Why does -v not work until after "}" in this script?
>
> # su - nobody
> No directory, logging in with HOME=/
> $ cat /tmp/o
> {
> set -v
> # NO STDERR
> }
> # YES STDERR
> $ sh /tmp/o
> # YES STDERR
Because bash reads its
On Mon, Jul 30, 2012 at 02:17:15PM -0700, Andrew Resch wrote:
> I am attempting to use exec and tee to have my scripts
> stdout/stderr appended to a log file like such: exec > >(tee -a $LOG)
> 2>&1
> These scripts will often call other scripts with a similar
> exec statement, often
On Mon, Aug 06, 2012 at 09:14:11PM -0400, Chet Ramey wrote:
> > [6]$ ls "hello world!"
> > bash: !": event not found
>
> Thanks for the report. This has already been changed for the next version.
Ah, so you've changed your stance a decade after
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=13
On Fri, Aug 17, 2012 at 03:19:56PM +0800, John Summerfield wrote:
> In two cases I wish to pass an array in the environment, like so:
> 14:28 john@Boomer$ STUFF[1]=one STUFFX=stuffx env | grep ^ST
> STUFFX=stuffx
> STUFF[1]=one
You are creating an environment variable called "STUFF[1]". This is
a
On Fri, Aug 24, 2012 at 10:01:32AM -0400, Chet Ramey wrote:
> On 8/24/12 8:54 AM, Michal Soltys wrote:
> > In case of single '=' operator used in [[ ]], rhs argument
> > was treated as a pattern. Only == and != should treat rhs argument as a
> > pattern, so this patch fixes it.
>
> Incorrect; `='
On Fri, Aug 24, 2012 at 10:34:44AM -0400, Chet Ramey wrote:
> > On Fri, Aug 24, 2012 at 10:01:32AM -0400, Chet Ramey wrote:
> > > On 8/24/12 8:54 AM, Michal Soltys wrote:
> > > > In case of single '=' operator used in [[ ]], rhs argument
> > > > was treated as a pattern. Only == and != should trea
On Tue, Sep 11, 2012 at 09:24:39PM +0600, ?? wrote:
> 1. Can you give me link (or name of) posix standard where I can read about
> this?
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25
"When this option is on, if a simple command fails
hem.
It's even worse on some systems:
imadev:/tmp/greg$ ls [a-c]
A a Á á À à Â â Ä ä Å å Ã ã Æ æ B b C c
Never use character range expressions outside of the C locale. They
are implementation-defined, meaning you get totally unexpected results.
On Sat, Sep 15, 2012 at 06:12:24PM -0600, Bob Proulx wrote:
> I don't know so I will ask. Isn't the problem endemic to glibc? Do
> other libc's such as HP-UX or AIX or other have this same issue? I am
> out of touch on the details of them these days.
imadev:/tmp/greg$
On Mon, Oct 01, 2012 at 11:14:31AM +, eduardo.damasio-da-co...@stfc.ac.uk
wrote:
> The command sort -k 3,3 lixo > lixo4 does not sort lixo as I was expecting.
> For example, by line 385 lixo4 shows:
> 69.1875 -59.2511 1.00242e-05
> 70.875 -62.0592 1.00242e-05
> 145.125 -74.9763 1.00252
On Tue, Oct 02, 2012 at 10:01:43AM -0700, Linda Walsh wrote:
> >On 9/28/12 9:54 AM, Yuxiang Cao wrote:
> >>test.sh: xmalloc: ../bash/unwind_prot.c:308: cannot allocate 172 bytes
> >>(8359936 bytes allocated)
> Why shouldn't bash fail at the point it hits resource exhaustion and return
> an error
On Wed, Oct 03, 2012 at 05:07:16AM +, Yuxiang Cao wrote:
> Hi,
> After second thought, I carefully read the bash manual page and find this
> information. Functions may be recursive. The FUNCNEST variable may be used to
> limit the depth of the function call stack and restrict the number of
> fu
On Wed, Oct 03, 2012 at 01:00:21PM +, Yuxiang Cao wrote:
> Hi, this is a interesting problem. Because My bash version is 4.1.5, so I
> simply run the similar thing as your code which give me this
> frank@frank-laptop:~/research/realfault$ bash -c 'FUNCNEST=100; a() { echo
> "$1"; a $(($1+1)
On Wed, Oct 03, 2012 at 01:23:58PM -0600, Bob Proulx wrote:
> But in any case, is there
> anything in there that is about bash? If so the we need an exact test
> case.
You could start with this one:
imadev:~$ bash-4.2.28 -c 'a() { echo "$1"; a $(($1+1)); }; a 1' 2>&1 | tail
Pid 4466 receive
Here's an updated version of a patch I did a few years ago to add loadable
support for bash under HP-UX 10. The previous patch was for bash 4.0.
This one has been updated for bash 4.2. It is fundamentally the same
patch, just with different context and line numbers and stuff, so that
it applies c
I've been staring at this for way too long now and I can't figure it out.
imadev:/var/tmp/bash/bash-4.2/examples/loadables$ make
/net/appl/gcc-3.3/bin/gcc -fpic -DHAVE_CONFIG_H -DSHELL -DHPUX -g -O2 -I. -I..
-I../.. -I../../lib -I../../builtins -I../../include -I/var/tmp/bash/bash-4.2
-I/var/tmp
On Fri, Oct 05, 2012 at 05:20:23PM +0200, Andreas Schwab wrote:
> Greg Wooledge writes:
>
> > Line 1209 says:
> > # if (ULLONG_MAX != LLONG_MAX)
> >
> > LLONG_MAX expands to:
> > ((long long int) (~ (long long int) 0 - ((long long int) ((! ((long l
On Thu, Oct 11, 2012 at 08:01:40PM -0700, Tinni wrote:
> I am very new to the shell scripting.. Need some pointers for getting the
> return value in shell scripting.
"Return value" is an integer from 0 to 255. That's not what you want.
> I want the values ( db_host_user, db_host, ORACLE_SID)
On Fri, Oct 12, 2012 at 06:55:28AM -0400, Sergey Fadeev wrote:
> Why doesn't it exit the shell?
> $ set -e
> $ echo $(false)
Because the exit status of echo is 0.
On Sun, Oct 14, 2012 at 05:21:05PM -0700, Linda Walsh wrote:
> Steven W. Orr wrote:
> >Seriously, can we just put a trap on all messages to this list that have
> >the string 'set -e' in it? Just point the sender to a message that tells
> >them to not use it.
>
>
> Seriously -- why not just
On Mon, Oct 15, 2012 at 10:04:39AM +0800, Tinni wrote:
> Thank you so much for your reply and explanation.
>
> >>So, you're trying to retrieve 3 separate (string?) values from a remote
> system.
>
> Yes.
>
> >> Why not simply prompt the user for the
> information on the local system and skip t
On Mon, Oct 15, 2012 at 04:00:01PM -0400, DJ Mills wrote:
> I'm also not entirely sure what you mean by "errexit will always be
> stored as off."
My interpretation is that he wants to write a "portable function" for
someone else to use, and that he wants to use errexit while inside it,
and therefo
On Tue, Oct 16, 2012 at 12:01:56AM +0300, Nikolai Kondrashov wrote:
> I'm trying to implement a pair of functions that would save/restore option
> state onto/from a stack, so I could modify options temporarily for some
> parts
> of code. I've worked around this problem already and it is not the su
On Mon, Oct 15, 2012 at 08:08:10PM -0400, DJ Mills wrote:
> done < <(set -o)
Huh... that's interesting. I wouldn't have expected it, but it turns
out you don't "lose" the value of errexit in a process substitution the
way you do in a command substitution.
imadev:~$ bash -c 'set -e; x=$(set +o);
On Tue, Oct 16, 2012 at 02:18:40PM -0700, car...@taltos.org wrote:
> if [[ "foo1" =~ ".*([0-9])" ]]; then
As others have said, you must NOT quote the regular expression on the
right-hand side of the =~ operator. If you quote it, it becomes a
plain string, overriding the =~ operator entirely.
The
On Wed, Oct 17, 2012 at 09:49:10AM -0700, giuseppe.amatu...@gmail.com wrote:
> ls *.txt | xargs -n 1 -P 10 bash myscript.sh
This has some serious flaws already. ls may mangle the filenames that
it is feeding to xargs. Any filenames that have spaces or quotes in
them will be bungled by xargs its
On Wed, Oct 17, 2012 at 10:52:37AM -0700, giuseppe.amatu...@gmail.com wrote:
> find . -maxdepth 1 -name '*.txt' -print0 | xargs -n 1 -P 10 bash -c 'echo
> "$1" '
> do not print $1 so the argument (-n 1) is not passed inside.
OK, first thing: you omitted the -0 on xargs.
Next, please realiz
On Fri, Nov 09, 2012 at 11:07:28AM -0500, Chet Ramey wrote:
> On 11/9/12 4:09 AM, wuya wrote:
> >2. this format gives user an implication that by executing these
> > `declare' commands, all those variables got exported, but this is only
> > partly true as it fails in functions.
>
> That's no
On Fri, Nov 09, 2012 at 11:18:24AM -0500, Greg Wooledge wrote:
> restore_environment() {
> set -o posix
> eval "$saved_output_of_export_dash_p"
> set +o posix
> }
Err, what I meant was:
save_environment() {
set -o posix
saved_env=$(export -p)
set +o pos
On Sat, Nov 24, 2012 at 10:29:30PM +, Lawrence Steeger wrote:
> Alex Chupin (achupin cisco.com> writes:
> > $ bash --version; s=12345;if [[ "$s" =~ '^[0-9]+$' ]]; then echo it is a
> number; else echo it is NOT a number; fi
> The single quotes are being used in the match. If you remove them,
On Sun, Nov 25, 2012 at 06:33:19AM +0100, Rene Herman wrote:
> I'm currently writing a larger bash script to manage my (ogg vorbis)
> music collection, including maintaining tags. Vorbis files can and
> (mine) often will contain repeated tags such as, say, "artist=David
> Crosby" and "artist=Gra
On Tue, Nov 27, 2012 at 07:57:28PM +0100, Tim Friske wrote:
> I came accross the `-v` option of the `test` command and wondered how I
> would possibly test not only string- and integer- but also array variables
> as a whole and in parts.
Sounds more like a help-bash question than a bug-bash questi
On Wed, Nov 28, 2012 at 09:10:02AM -0800, Mun wrote:
> I need to run a script via cron that in turn launches a script to set up the
> requisite environment variables needed for a successive script that is called.
> Moreover, I need to change my group ID in order for the scripts called within
> the
On Tue, Dec 11, 2012 at 02:31:28PM -0500, DJ Mills wrote:
> First of all, the man page and help output state:
> `The return status of a coprocess is the exit status of command.'
> No matter what, coproc seems to always return true.
>
> To reproduce:
> coproc false || echo error1 >&2;
On Fri, Dec 14, 2012 at 08:37:02AM +0100, Francis Moreau wrote:
> Then maybe an option should be added to 'local' to display the full
> description that one can get from the manual, or maybe change the
> behaviour of '-m' switch ?
Almost every builtin command has a shorter and less informative
des
On Wed, Dec 19, 2012 at 04:49:32PM -0500, Chet Ramey wrote:
> I get the same results if I run the pipeline in an interactive shell.
> This is pretty much what I expect. The whitespace and newlines will
> disappear due to read's $IFS processing if they're first or last in
> the string.
Which is wh
On Thu, Dec 20, 2012 at 07:43:50AM -0800, giuseppe.amatu...@gmail.com wrote:
> for dir in UA_tile_tif_pop_txt UA_buf10_tile_tif_pop_txt
> UA_buf20_tile_tif_pop_txt UA_buf30_tile_tif_pop_txt UA_buf40_tile_tif_pop_txt
> UA_buf50_tile_tif_pop_txt ; do echo $dir ; done | xargs -n 1 -P 6 bash -c '
>
On Tue, Jan 08, 2013 at 10:26:19PM +, John Caruso wrote:
> I checked the
> bash source but couldn't suss out (in a brief look) how minor bash
> versions are accounted--there's no 4.2.10 or 4.2.24 source, just 4.2
> source plus a bunch of patches, and it's not clear if those patches have
> made
On Fri, Jan 11, 2013 at 10:21:55PM +0800, Ma Shimiao wrote:
> I used commands as follows:
> $seq 5 | mapfile -C echo -c1
> 0 1
>
> 1 2
>
> 2 3
>
> 3 4
>
> 4 5
>
> I would have expectd 1,2,3,4,5 above from the"help mapfile".
> Is it a bug of mapfile?
The help says:
When CALLBACK is evalu
shopt -s checkwinsize only works in interactive shells. However, this
is not mentioned in the manual.
Tested in Bash 4.2.37.
#!/bin/bash
trap 'echo "COLUMNS is now <$COLUMNS>"' WINCH
test -z "$COLUMNS" && COLUMNS=$(tput cols)
shopt -s checkwinsize
while sleep 1; do :; done
Run in a terminal, re
On Sun, Jan 13, 2013 at 03:31:24AM +0100, John Kearney wrote:
> set -o errexit
> test_func() {
> [ ! -d test ] && echo test2
> }
>
> echo test3
> test_func
> echo test4
>
> now so long as test doesn't exist in the cwd it should errexit.
> at least it did for me just now.
Cannot reproduce.
i
On Mon, Jan 14, 2013 at 08:08:53PM +0100, John Kearney wrote:
> this should exit.
> #!/bin/bash
>
> set -e
> f() { test -d nosuchdir && echo no dir; }
> echo testings
> f
> echo survived
OK, cool. That gives me more ammunition to use in the war against set -e.
==
On Tue, Jan 15, 2013 at 11:30:39AM -0500, DJ Mills wrote:
> I believe that's referring to var=value command, as in the syntax to export
> a variable into "command"s environment.
>
> readonly a=3
> a=2 echo foo
I thought that was what it meant, too, but I couldn't reproduce the "bug"
that it was c
On Tue, Jan 22, 2013 at 06:56:31AM -0500, Steven W. Orr wrote:
> By that logic,
>
> foo 2>&1 | bar
>
> should not work, but it does. It takes stderr and dups it to stdout, and
> *then* takes stdout and send it to a pipe.
Incorrect. The pipeline is created first, and *then* the dup (2>&1) is
pe
On Tue, Jan 22, 2013 at 07:45:10PM +0100, Andreas Schwab wrote:
> Greg Wooledge writes:
> > On Tue, Jan 22, 2013 at 06:56:31AM -0500, Steven W. Orr wrote:
> >> foo 2>&1 | bar
> > The pipeline is created first, and *then* the dup (2>&1) is
> > performe
On Wed, Feb 06, 2013 at 12:39:45AM +0100, Tiwo W. wrote:
> When using this in a script of mine, I noticed that this fails
> when errexit is set ("set -e").
Most things do. set -e is crap. You should consider not using it.
> * why does it work with "set +e" ?
Because set
On Wed, Feb 06, 2013 at 07:12:01PM +0100, John Kearney wrote:
> IFS= read -rd '' var2 <
> should work.
Which is essentially equivalent to doing "set +e" before, and "set -e"
again right after. In either case, you're temporarily working around
the brokenness of set -e for a single command.
On Mon, Feb 11, 2013 at 06:59:35PM +, Alan Mackenzie wrote:
> From a bash script, I'd like to be able to start several subtasks and
> react to any one of them completing. I don't think I can do this with
> the current bash. The `wait' function either waits on a specified subtask
> to finish,
On Mon, Feb 11, 2013 at 06:50:49PM +0100, Dashing wrote:
> $ ./pe 'mplayer foo1\ foo2\ foo3\ 4\ 5\ foo6\ 7'
> :--Mistake--:
> :--Mistake--:
Whatever you're doing, it's wrong.
./pe mplayer foo1\ foo2\ foo3\ 4\ 5\ foo6\ 7
#!/bin/bash
prog=$1
shift
exec "$prog" extra args go here "$@"
THAT is how
On Tue, Feb 12, 2013 at 02:37:03PM +0100, Dashing wrote:
> For my purposes this is irrelevant, because the nature of the
> script from which my example code derived is tab completion.
> READLINE_LINE will contain mplayer foo1\ foo2\ etc.
Then you are still doing something wrong.
imadev:~$ args
On Tue, Feb 12, 2013 at 11:07:06AM -0500, Matei David wrote:
> On a different but related note, I hate having to do eval to manipulate an
> fd stored in a variable. Why doesn't 'llfd $x>&-' work, especially since
> 'llfd >&$x' works just fine... so by the time >& is handled, the variable
> substitu
On Tue, Feb 12, 2013 at 04:20:53AM -0800, laurent.tes...@gmail.com wrote:
> > liste=`ls *.T02`
This is broken because filenames may contain spaces, newlines, etc.
Use an array instead:
liste=(*.T02)
See http://mywiki.wooledge.org/BashPitfalls for an explanation of some
of the issues.
This type
POSIX specifies the behavior of a shell. This tells Chet how he has to
make Bash behave (with some leeway). There are all kinds of silly little
details and ambiguities that Chet has to worry about.
However, YOU as a shell script writer do not have to worry about all
that crap. All you have to d
On Tue, Feb 26, 2013 at 01:27:35PM -0800, Linda Walsh wrote:
> Except it isn't a script -- it's input that came from
> the terminal, that got repetitively edited using vi mode, until it got
> saved in a file so it could continue to be edited, and stay on the screen
> while executing it in the
On Wed, Mar 13, 2013 at 11:52:54PM -0700, Linda Walsh wrote:
> Sorta makes the idea of a restricted shell a bit less useful.
Honestly, a "restricted shell" is usually a pitiful thing that would be
a joke, except it's not even funny. It's what people tried to use for
security back in like 1990 whe
On Wed, Mar 27, 2013 at 11:29:38AM -0700, Linda Walsh wrote:
> include lib/Util/Needroot.shh
>
> where include is a function the name of a file in my path (or an alias
> to define the function)...
>
>
> /home/law/bin/recycle_space: line 7: lib/Util/needroot.shh: division by
> 0 (error token is "
On Wed, Mar 27, 2013 at 12:17:21PM -0700, Linda Walsh wrote:
> dcl -xa _FPATH
Arrays cannot be exported. The bash manual explicitly says so:
Array variables may not (yet) be exported.
> } | ( ((!(remove||expire))) && hsort -s || cat)
Use of the && and || operators together as a "shorthan
On Wed, Mar 27, 2013 at 01:25:53PM -0700, Linda Walsh wrote:
> Greg Wooledge wrote:
> > Arrays cannot be exported. The bash manual explicitly says so:
> >
> > Array variables may not (yet) be exported.
> ===
> It is there for the 'yet' part
601 - 700 of 1969 matches
Mail list logo