Re: bash syntax

2021-07-30 Thread Teemu Likonen
* 2021-07-30 07:41:23-0400, Greg Wooledge wrote: > On Fri, Jul 30, 2021 at 08:48:28AM +0300, Teemu Likonen wrote: >> You have already got answers but here is another. Bash has a special >> arithmetic evaluation mode which happens in: >> >> let ... # returns true (0) or false (1) >>

Re: bash syntax

2021-07-30 Thread Greg Wooledge
On Fri, Jul 30, 2021 at 08:48:28AM +0300, Teemu Likonen wrote: > scanimage > /home/mick/DATA/SCANS/scan-$((++ct)).pnm Correct, but not necessarily an improvement over the original code. It depends on your taste for complexity. > You have already got answers but here is another. Bash has a spe

Re: bash syntax

2021-07-29 Thread Teemu Likonen
* 2021-07-29 21:16:26+0100, mick crane wrote: >4 ((ct++)) >5 scanimage > /home/mick/DATA/SCANS/scan-$ct.pnm Items 4 and 5 could be combined using $((++ct)): scanimage > /home/mick/DATA/SCANS/scan-$((++ct)).pnm > What's the thing with the ct being in double brackets and not having >

Re: bash syntax

2021-07-29 Thread Greg Wooledge
On Thu, Jul 29, 2021 at 07:38:07PM -0400, kamaraju kusumanchi wrote: > On Thu, Jul 29, 2021 at 4:23 PM Greg Wooledge wrote: > > > > On Thu, Jul 29, 2021 at 09:16:26PM +0100, mick crane wrote: > > > 4 ((ct++)) > > > > > What's the thing with the ct being in double brackets and not having the > >

Re: bash syntax

2021-07-29 Thread kamaraju kusumanchi
On Thu, Jul 29, 2021 at 4:23 PM Greg Wooledge wrote: > > On Thu, Jul 29, 2021 at 09:16:26PM +0100, mick crane wrote: > > 4 ((ct++)) > > > What's the thing with the ct being in double brackets and not having the "$" > > ? > > https://mywiki.wooledge.org/ArithmeticExpression > Nice wiki page, Gre

Re: bash syntax

2021-07-29 Thread der.hans
Am 29. Jul, 2021 schwätzte mick crane so: moin moin nick, I nicked this off some guy on the internet. 1 #!/bin/bash 2 count_file="scan_count.txt" 3 ct=`cat $count_file` 4 ((ct++)) 5 scanimage > /home/mick/DATA/SCANS/scan-$ct.pnm 6 echo $ct > $count_file What's the thing with the ct being

Re: bash syntax

2021-07-29 Thread Greg Wooledge
On Thu, Jul 29, 2021 at 09:16:26PM +0100, mick crane wrote: > 4 ((ct++)) > What's the thing with the ct being in double brackets and not having the "$" > ? https://mywiki.wooledge.org/ArithmeticExpression

bash syntax

2021-07-29 Thread mick crane
I nicked this off some guy on the internet. 1 #!/bin/bash 2 count_file="scan_count.txt" 3 ct=`cat $count_file` 4 ((ct++)) 5 scanimage > /home/mick/DATA/SCANS/scan-$ct.pnm 6 echo $ct > $count_file What's the thing with the ct being in double brackets and not having the "$" ? scan_cou

Re: bash syntax question

2008-06-06 Thread Malte Forkel
Alfredo Finelli schrieb: The 'date' command runs in a child process for which the bash shell has to determine the environment. Parameter assignments are inherited in that environment (i.e. the 'date' command sees them) in two cases: either when the variable is not only declared but also expor

Re: bash syntax question

2008-06-06 Thread Alfredo Finelli
On Friday 06 June 2008 12:59, Malte Forkel wrote: > I recently came across the following example for switching time > zones: > > $ date > Fr 6. Jun 12:49:30 CEST 2008 > $ TZ=UTC date > Fr 6. Jun 10:49:35 UTC 2008 > > Could someone please explain to me the general shell syntax involved > here? I did

bash syntax question

2008-06-06 Thread Malte Forkel
I recently came across the following example for switching time zones: $ date Fr 6. Jun 12:49:30 CEST 2008 $ TZ=UTC date Fr 6. Jun 10:49:35 UTC 2008 Could someone please explain to me the general shell syntax involved here? I did not know that I could put an assignment and a command on one line

Re: bash syntax

1997-11-29 Thread Rick Macdonald
On Sat, 29 Nov 1997, Alan Su wrote: > Rick Macdonald wrote (Thu, 27 Nov 1997 19:27:13 -0700 (MST) ): > |> > |>> Yup, you're right; it's probably a bug. This does work: > |>> > |>> ( (ls);(ls)) > |> > |>> Try changing the definition of the helper in Netscape to follow the > |>> above syntax. > |>

Re: bash syntax

1997-11-29 Thread Rick Macdonald
On Wed, 26 Nov 1997, Witold Grabysz wrote: > Remco van de Meent wrote: > > > On Mon, 24 Nov 1997, Witold Grabysz wrote: > > > > : the following phrase doesn't work in bash: > > : ((ls);(ls)) > > : Why? Is it not allowed by the shell syntax or there is a bug in it? > > : > > : It is a little

Re: bash syntax

1997-11-29 Thread Rick Macdonald
On Tue, 25 Nov 1997, Stephen Zander wrote: > "Eloy A. Paris" wrote: > > Witold Grabysz <[EMAIL PROTECTED]> wrote: > > > > : the following phrase doesn't work in bash: > > : ((ls);(ls)) > > : Why? Is it not allowed by the shell syntax or there is a bug in it? > > > > Yup, you're right; it's proba

Re: bash syntax

1997-11-28 Thread tibor simko
> "rick" == Rick Macdonald <[EMAIL PROTECTED]> writes: rick> Can anybody confirm if this is fixed in bash-2.01? $ bash -version GNU bash, version 2.01.0(1)-release (i486-debian-linux-gnu) Copyright 1996 Free Software Foundation, Inc. $ ls -l total 0 -rw--- 1 simkosimko

Re: bash syntax

1997-11-28 Thread Rick Macdonald
On 25 Nov 1997, Eloy A. Paris wrote: > Witold Grabysz <[EMAIL PROTECTED]> wrote: > > : the following phrase doesn't work in bash: > : ((ls);(ls)) > Yup, you're right; it's probably a bug. This does work: > > ( (ls);(ls)) Can anybody confirm if this is fixed in bash-2.01? > Try changing the de

Re: bash syntax

1997-11-26 Thread Witold Grabysz
Remco van de Meent wrote: > On Mon, 24 Nov 1997, Witold Grabysz wrote: > > : the following phrase doesn't work in bash: > : ((ls);(ls)) > : Why? Is it not allowed by the shell syntax or there is a bug in it? > : > : It is a little important for me, because it is how the Netscape 4 spawns > :

Re: bash syntax

1997-11-25 Thread Torsten Hilbrich
"Eloy A. Paris" <[EMAIL PROTECTED]> writes: > Witold Grabysz <[EMAIL PROTECTED]> wrote: > > : the following phrase doesn't work in bash: > : ((ls);(ls)) > : Why? Is it not allowed by the shell syntax or there is a bug in it? > > Yup, you're right; it's probably a bug. This does work: > > ( (ls)

Re: bash syntax

1997-11-25 Thread Stephen Zander
"Eloy A. Paris" wrote: > Witold Grabysz <[EMAIL PROTECTED]> wrote: > > : the following phrase doesn't work in bash: > : ((ls);(ls)) > : Why? Is it not allowed by the shell syntax or there is a bug in it? > > Yup, you're right; it's probably a bug. This does work: > > ( (ls);(ls)) > > Try changi

Re: bash syntax

1997-11-25 Thread Eloy A. Paris
Witold Grabysz <[EMAIL PROTECTED]> wrote: : the following phrase doesn't work in bash: : ((ls);(ls)) : Why? Is it not allowed by the shell syntax or there is a bug in it? Yup, you're right; it's probably a bug. This does work: ( (ls);(ls)) Try changing the definition of the helper in Netscape t

Re: bash syntax

1997-11-24 Thread Remco van de Meent
On Mon, 24 Nov 1997, Witold Grabysz wrote: : the following phrase doesn't work in bash: : ((ls);(ls)) : Why? Is it not allowed by the shell syntax or there is a bug in it? : : It is a little important for me, because it is how the Netscape 4 spawns : an external helper: : ((gv temp_file.ps

bash syntax

1997-11-24 Thread Witold Grabysz
Hello, the following phrase doesn't work in bash: ((ls);(ls)) Why? Is it not allowed by the shell syntax or there is a bug in it? It is a little important for me, because it is how the Netscape 4 spawns an external helper: ((gv temp_file.ps);(rm temp_file.ps)) In tcsh it works, however I cannot