Linked Questions
28 questions linked to/from Spaces in variable assignments in shell scripts
4
votes
4
answers
2k
views
Why is foo=bar different from foo= bar? [duplicate]
What is the interpretation of the whitespace in this command foo= bar ?
Why are foo=bar and foo= bar interpreted differently
Example (Ubuntu bash)
developer@1604:~$ foo=bar
developer@1604:~$ foo= ...
4
votes
2
answers
3k
views
Script throwing error "=: not found" [duplicate]
Consider:
#!/bin/ksh
db2 connect to MKTETLPS user ....... using ........
db2 "select count(*) from etl.IDM_COLLAPSE_ORG_DEE c where c.IDM_PROCESS_STEP = 'I' and priority in ( '1','2','3','4','5') ...
0
votes
3
answers
2k
views
Bash - Set a variable [duplicate]
I need to set a variable in my bash script
#!/usr/bin/env bash
GITNAME= git config --global user.name
echo " $GITNAME "
But it doesn't seems to work that way.
How does it work?
3
votes
2
answers
3k
views
Command works at the command-line, but won't work in a shell script [duplicate]
I am creating a script and when I try to capture a command return, I have an error of command not found, if I use this command on the terminal:
gcloud -q compute snapshots list --format='csv(NAME)'
...
0
votes
1
answer
5k
views
cannot open file as first argument [duplicate]
I am trying to run a script like :
./script.sh file
but I am receiving ( if I use a txt file ):
=: cannot open `=' (No such file or directory)
test.txt: ASCII text
Second
If I use a gz file:...
1
vote
1
answer
7k
views
Assigning value to array at certain index [duplicate]
Hi am trying to write a script that updates a row read from file ,
Every thing is working fine so far except the following mentioned
line at the end
here is my script :
#!/bin/bash
#...
0
votes
1
answer
5k
views
Bash: Set variable equal to a string substitution [duplicate]
I'm trying to replace a substring in $1 with another, AND set it to a variable.
(saved as testStringReplacement file)
#!/bin/bash
secondString="Sara"
myString= "${1/Suzi/$secondString}"
echo "...
1
vote
1
answer
147
views
Foldername as parameter [duplicate]
As part of a txt file with instructions on how to run, I use a folder name as a parameter as shown below. However, LINUX does not recognize it. What could I be doing wrong?
foldername = "SOPHIE_TRANS"...
1
vote
1
answer
74
views
Output in variable shouldn't be interpreted as command [duplicate]
So this question was asked some times already, but the answers didn't seem to work for me. So I have this simple script
#!/bin/bash
charon_id = $(pidof charon)
kill -1 $charon_id
And console says ...
0
votes
1
answer
161
views
Escape slashes when sending command output to an array [duplicate]
In my current project, I am trying to take the output from git branch -r to an array in zsh, as follows:
% all_branches = ("${(@f)$(git branch -r)}")
However, when I run this command, I get ...
0
votes
0
answers
150
views
Jenkins - Bash if else statement variable not found [duplicate]
I am having a steps in Jenkins pipeline to read my test passing result and fail the Stage if rate lower than 95%.
Here's the code
sh ''' #!/bin/bash -xe
PASS= `cat index.txt | grep % ...
0
votes
1
answer
38
views
bash: URL: command not found [duplicate]
I keep getting the following error in bash (using windows):
$ URL = "https://nyc-tlc.s3.amazonaws.com/trip+data/yellow_tripdata_2022-01.parquet"
bash: URL: command not found
The full ...
-1
votes
1
answer
56
views
How to define a variable on Debian 10 command line? [duplicate]
I am defining a variable on Debian 10 command line but getting the error.
Do anyone know how can I do that?
Thank you,
0
votes
0
answers
24
views
script execution error [duplicate]
I am trying to run my script which checks for a file existence and validates its records.
If validation is successful it uploads the input file to database.`
While executing the script ,it loads the ...
0
votes
0
answers
20
views
Concatenating string with a dash in multiple choice [duplicate]
I need to Concatenat string with leading dash in multiple choice to variable, but it doesn't work as expected and I don't know what is the problem
#!/bin/bash
filterOptionsStr=""
PS3='...