1
rated 0 times
[
1]
[
0]
/ answers: 1 / hits: 798
/ 1 Year ago, mon, december 26, 2022, 1:52:01
I ran the below code through shellcheck myscript and keep getting this error. How can I correct it?
****Line 48:
while [ $count - lt 3 ]
^-- SC1009: The mentioned syntax error was in this while loop.
^-- SC1073: Couldn't parse this test expression. Fix to allow more checks.**
^-- SC1076: Trying to do math? Use e.g. [ $((i/2+7)) -ge 18 ].
^-- SC1072: Expected a test operator. Fix any mentioned problems and try again.**
#!/bin/bash
touch.bash_profile
mkdir login.sh
chmod + x login.sh
echo "Enter Your Username."
read user
echo "Enter Your Password."
read pass
# to check blank inputs
if [ -z "$user" ] ||
[ -z "$pass" ]
then
echo 'Inputs cannot be blank. Please retry.'
# Checking entered username and password with actual credentials
# if matched
if [ "$Username" = "Alpha" ] ||
[ "$Password" = "Beta" ] ;
then
pwd
else
# if not matched
count = 1
while [ $count - lt 3 ]
do
if["$Username" != "$user"]
||["$Password" != "$pass"];
then
left = 3 - $count
echo b
More From » bash