help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] What is the usage of BASH_ARGV


From: Chris F.A. Johnson
Subject: Re: [Help-bash] What is the usage of BASH_ARGV
Date: Sun, 14 Aug 2016 19:42:35 -0400 (EDT)
User-agent: Alpine 2.10 (DEB 1266 2009-07-14)

On Sun, 14 Aug 2016, Peng Yu wrote:

Hi, It is not quite clear what is the usage of BASH_ARGV according to
bash manual.

For example, I can not see how BASH_ARGV is useful (at least it does
not affect "$@"). Does anybody know the real usage of BASH_ARGV?

~$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

declare -p BASH_ARGV
BASH_ARGV=(a b c)
echo "$@"
~$ ./main.sh
declare -a BASH_ARGV='()'

~/linux/test/bash/man/variable/BASH_ARGV/set$ ./main.sh

  I have used it to get the arguments in reverse order, viz.:

#!/bin/bash
printf '%s\n' "$@"
echo
printf '%s\n' "address@hidden"


--
Chris F.A. Johnson, <http://cfajohnson.com>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]