Skip to content

Tag: bash

Bash Syntax Error syntax error: unexpected end of file

We are using the Bourne-Again Shell. What does this error mean?: syntax error: unexpected end of file Answer The single quoted string starting with is missing the closing single quote. SO’s syntax highlighting shows it, too. Maybe you wanted to backslash the quote? or there are double quotes missing too…

Bash: Parse CSV and edit cell values

I am new to bash scripting I have the following CSV Input Expected Output I need to check Location and Way and convert them to UpperCase – ABC, UP Day needs to be mon – Mon I need to do this for entire CSV. I need to correct the value and write all the fields on to CSV or edit

Bash script: cd No such file or directory when file exists

My bash script is written to go to each subfolder in the current directory: When I run my bash script, I am getting a cd error for a directory that exists: Yet, in terminal command line I can do cd ‘Zelkova serrata’ within the same directory as the script and all is fine. Is it possible the bash s…

Error retreiving database name wordpress

I was trying the below code to retrieve database name from wordpress configuration file. But somehow a single inverted comma at the beginning is causing trouble. As given below it shows the output without any special characters but the below error shows an issue. Answer carriage return (r) caused the issue. T…

Running statistics on multiple lines in bash

I have multiple HTTP headers in one giant file, separated with one empty line. I have approximately 10,000,000 of headers separated with an empty line. If I want to discover trends, like header order, I want to do aggregate headers to a one-liner (how I can aggregate lines ending with an empty line and do tha…

Unexpected behaviour of double quotes in bash script

I’ve created a variable which looks like this: If I print it to the terminal, using echo $firstAndLastLines, I get the following output: root bin daemon adm lp Privilege-separated SSH Account used by the trousers package to sandbox the tcsd daemon Norbert Fogarasi But, if I use echo “$firstAndLast…