Linked Questions

-1 votes
2 answers
5k views

I got error message as if[ 0 -lt 1] command not found. I just started shell scripting. I don't know what's wrong in my code: if[ $# -lt 1 ] then echo "Give a number as a parameter. Try again." ...
Rachita Nayak's user avatar
2 votes
1 answer
4k views

My bash script keeps failing because it gets confused at the hyphen: if [ ! -d "$openssl-1.0.1i"]; then ... How do I escape it correctly?
Ralphie Aguayo's user avatar
1 vote
2 answers
6k views

I'm trying to do test automation with a bash script using if then else statements but I'm running into a few errors. For one, when I try to execute it I'm doing something wrong with the variable ...
csStudent's user avatar
  • 128
0 votes
2 answers
3k views

I am using Cygwin to run a script, I am getting syntax error when i use if else condition. Can you please tell me what is wrong with my script ? ./test.sh: line 10: syntax error near unexpected ...
Houssem Hariz's user avatar
1 vote
1 answer
4k views

This is my Dockerfile: FROM tomcat:9 RUN apt-get update RUN apt-get install -y iputils-ping file ARG TARGETARCH RUN if ["$TARGETARCH" = "amd64"]; then \ apt-get install -y ...
smallufo's user avatar
  • 11.9k
0 votes
2 answers
3k views

I am a beginner in shell scripting. I am trying to write a shell script which reads a file and prints out the lines in the file that starts with and ends with a certain word - say "Hi" in my case.. ...
user9185187's user avatar
1 vote
2 answers
2k views

I'm pretty new to shell programming languages. Why does the following code echo false after printing "File or directory not found."? #!/bin/sh -xu ARG_PATH="/srv/path/to/Something" if ["$ARG_PATH" = ...
chrisTRD's user avatar
0 votes
1 answer
3k views

I had to try to make a code to automate steamcmd but it always gives me the following error: syntax error near unexpected token 'fi' Code: STEAMCMDDOWN="https://steamcdn-a.akamihd.net/client/...
Rube200's user avatar
0 votes
3 answers
992 views

I have put together a bash script to identify a process and echo if process is running or not accordingly. My script: #!/bin/bash var1=$(ps -ef | grep -v grep | grep crond) echo $var1 if [$var1] ...
Moose's user avatar
  • 755
-1 votes
1 answer
1k views

I am creating a script where the user must provide the first argument that is mandatory and the second argument is optional. Should throw an error if it is less than 1 or bigger than 2 arguments. ...
IgorAlves's user avatar
  • 5,580
0 votes
3 answers
327 views

I'm using below if condition in shell script if [! -z "$failedTC"] || [-n "$failedTC"]; then echo "ITS not empaty AND NOT NULL" else echo "ITS empty or NULL" fi The above code I'm ...
ArrchanaMohan's user avatar
0 votes
1 answer
1k views

When i run the below command i get the output, however it throws command not found error. I have no idea why this error appears. Any suggestions? val1 = ps -ef|grep -i active | wc -l val2 = 2 ...
Nilan's user avatar
  • 115
0 votes
1 answer
1k views

I have some code that doesn't work. It's says, "No such file or directory", and crashes on line 27: while [ $i < $amount] But I don't know why. Anyone? #!/bin/bash #WWGEN Aleandro small=$(echo "...
Aleandro's user avatar
0 votes
1 answer
816 views

I need to read a string variable and to check if it's equal to string 'qwe'. I try this code: read VAR1 if ["$VAR1" == "rwx"]; then current=$current+1 fi but terminal says [...
Axmed's user avatar
  • 51
1 vote
1 answer
993 views

here is my simple script prova.sh: #!/bin/bash echo "\$# = [$#]" echo "\$1 = [$1]" if [ $# -ge 2 || $1="-h" ] then echo "###########################################...
DDS's user avatar
  • 2,480

15 30 50 per page
1
2
3 4 5
14