Skip to main content
deleted 48 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what's wrong with it, unless I'm making a rookie error or assumption.

I'm still getting an error from bash saying:

line 6: [: -lt: unary operator expected
line 16: [: -gt: unary operator expected

with this updated code:

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500 ]
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0 ]
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what's wrong with it, unless I'm making a rookie error or assumption.

I'm still getting an error from bash saying:

line 6: [: -lt: unary operator expected
line 16: [: -gt: unary operator expected

with this updated code:

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500 ]
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0 ]
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what's wrong with it.

I'm still getting an error from bash saying:

line 6: [: -lt: unary operator expected
line 16: [: -gt: unary operator expected

with this updated code:

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500 ]
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0 ]
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup
edited tags
Source Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k

Counting Program Queryprogram fails in arithmetic test

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what;swhat's wrong with it, unless I'm making a rookie error or assumption.

Any help would be appreciated, thanks.

EDIT*** Here is the updated code, and I'm still getting an error from bash saying:

line 6: [: -lt: unary operator expected
line 16: [: -gt: unary operator expected

line 6: [: -lt: unary operator expected line 16: [: -gtwith this updated code: unary operator expected

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500 ]
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0 ]
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup

Counting Program Query

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what;s wrong with it, unless I'm making a rookie error or assumption.

Any help would be appreciated, thanks.

EDIT*** Here is the updated code, and I'm still getting an error from bash saying:

line 6: [: -lt: unary operator expected line 16: [: -gt: unary operator expected

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500 ]
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0 ]
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup

Counting program fails in arithmetic test

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what's wrong with it, unless I'm making a rookie error or assumption.

I'm still getting an error from bash saying:

line 6: [: -lt: unary operator expected
line 16: [: -gt: unary operator expected

with this updated code:

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500 ]
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0 ]
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup
added 174 characters in body
Source Link

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what;s wrong with it, unless I'm making a rookie error or assumption.

Any help would be appreciated, thanks.

EDIT*** Here is the updated code, and I'm still getting an error from bash saying:

line 6: [: -lt: unary operator expected line 16: [: -gt: unary operator expected

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500]:500 ]
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0]:0 ]
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what;s wrong with it, unless I'm making a rookie error or assumption.

Any help would be appreciated, thanks.

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500]:
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0]:
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup

having a little trouble with this rather basic script. This script works on Bash in my macbook pro, but not on my Linux Mint desktop, which also uses bash.

I can't figure out what;s wrong with it, unless I'm making a rookie error or assumption.

Any help would be appreciated, thanks.

EDIT*** Here is the updated code, and I'm still getting an error from bash saying:

line 6: [: -lt: unary operator expected line 16: [: -gt: unary operator expected

#!/bin/bash
clear
counter=0

function countup {
while [ $counter -lt 500 ]
do
  ((counter++))
  echo $counter
  sleep 0.2
done
countdown
}

function countdown {
while [ $counter -gt 0 ]
do
  ((counter--))
  echo $counter
  sleep 0.2
done
countup
}

countup
Source Link
Loading