On 20/07/2024 05:25, Greg Wooledge wrote:
#!/bin/sh
echo "I am a.sh, and inside me, VAR=<$VAR>."
A way to report a bit more information:
cat /tmp/test.sh
#!/bin/sh
printf "%s: VAR %5s %10s value=<%s>\n" \
"$0" "${VAR+set}" "${VAR:+not empty}" "$VAR"
/tmp/test.sh
/tmp/test.sh: VAR
On 2024-07-20 06:35, Greg Wooledge wrote:
On Sat, Jul 20, 2024 at 06:30:42 +0800, p...@gmx.it wrote:
On 2024-07-20 06:25, Greg Wooledge wrote:
> >
> > I can not clearly understand for this statement. what's "future shell
> > commands"? can you show an example?
>
> hobbit:~$ unset -v VAR
> hobbit
On Sat, Jul 20, 2024 at 06:30:42 +0800, p...@gmx.it wrote:
> On 2024-07-20 06:25, Greg Wooledge wrote:
> > >
> > > I can not clearly understand for this statement. what's "future shell
> > > commands"? can you show an example?
> >
> > hobbit:~$ unset -v VAR
> > hobbit:~$ VAR=bar; ./a.sh
> > I am
On 2024-07-20 06:25, Greg Wooledge wrote:
I can not clearly understand for this statement. what's "future shell
commands"? can you show an example?
hobbit:~$ unset -v VAR
hobbit:~$ VAR=bar; ./a.sh
I am a.sh, and inside me, VAR=<>.
hobbit:~$ echo "VAR=<$VAR>"
VAR=
OK I know that. $VAR can be
On Sat, Jul 20, 2024 at 06:17:46 +0800, p...@gmx.it wrote:
> $ VAR=foo ./a.sh
> i can see VAR=foo
I don't know what "see" means here.
hobbit:~$ cat a.sh
#!/bin/sh
echo "I am a.sh, and inside me, VAR=<$VAR>."
hobbit:~$ unset -v VAR
hobbit:~$ VAR=foo ./a.sh
I am a.sh, and inside me, VAR=.
hobbit:~$
On 2024-07-20 05:56, Greg Wooledge wrote:
On Sat, Jul 20, 2024 at 05:46:23 +0800, p...@gmx.it wrote:
$ VAR1=foo && ./a.sh
$ export VAR2=foo; ./a.sh
$ ./b.sh
$VAR1 will be seen by a.sh only, but $VAR2 can be seen my current
login
session (such as b.sh). Am I right? I am a bit confused about env
On Sat, Jul 20, 2024 at 05:46:23 +0800, p...@gmx.it wrote:
> $ VAR1=foo && ./a.sh
> $ export VAR2=foo; ./a.sh
> $ ./b.sh
>
>
> $VAR1 will be seen by a.sh only, but $VAR2 can be seen my current login
> session (such as b.sh). Am I right? I am a bit confused about env scope.
If we assume NO other
On 2024-07-20 00:07, Mike Castle wrote:
In addition to what everyone else has said about env(1), there is the
fact that Korn derived shells also supports some of the same features.
env VAR1=foo VAR2=bar random-command
VAR1=foo VAR2=bar random-command
$ VAR1=foo && ./a.sh
$ export VAR2=foo; ./
In addition to what everyone else has said about env(1), there is the
fact that Korn derived shells also supports some of the same features.
env VAR1=foo VAR2=bar random-command
VAR1=foo VAR2=bar random-command
If running a Korn-like shell (ksh, bash, zsh), both would set the
envvars VAR1 and VAR
On 2024-07-19 at 09:02, Michel Verdier wrote:
> On 2024-07-19, p...@gmx.it wrote:
>
>> $ perl -le 'for( keys %ENV ){print "$_ --> $ENV{$_}"}' |grep perl
>> _ --> /usr/bin/perl
>>
>> the key for perl is "_" in environment variable? under this key, why
>> 'env perl' just works?
>
> Perl $_ is the
On 2024-07-19, p...@gmx.it wrote:
> $ perl -le 'for( keys %ENV ){print "$_ --> $ENV{$_}"}' |grep perl
> _ --> /usr/bin/perl
>
> the key for perl is "_" in environment variable? under this key, why
> 'env perl' just works?
Perl $_ is the current (unnamed) value of your loop "for". You could
write
Hi,
p...@gmx.it wrote:
> I am not sure how 'env' command works.
Read the output of
man env
> for example, what's the difference between '/usr/bin/perl' and 'env perl' ?
Reading the man page i'd say it's the same difference as between
"/usr/bin/perl" and "perl". I.e. the former runs explicit
On Fri, Jul 19, 2024 at 20:12:14 +0800, p...@gmx.it wrote:
> for example, what's the difference between '/usr/bin/perl' and 'env
> perl' ?
"env perl" searches your $PATH.
> I know env may set a environment variable in system, so my question also
> includes:
env is used to *display* the current s
Hello list,
I am not sure how 'env' command works.
for example, what's the difference between '/usr/bin/perl' and 'env
perl' ?
I know env may set a environment variable in system, so my question also
includes:
1. where to see a shell environment variable? I tried 'echo $ENV'
showing nothing.
14 matches
Mail list logo