I want to store the value of the sqlite statement in a variable backup=$(sqlite3 “/home/miguel/Desktop/SO/ProjetoFinal/Backup_Principal.db” “SELECT periocidade_backup FROM STORAGE WHERE path’$path’;”) But when i echo $backup it returns the following: sqlite3 “/home/miguel/Desktop/SO/ProjetoFinal/Backup_Principal.db” “SELECT periocidade_backup FROM STORAGE WHERE path=’$path’;” What am I doing wrong? Answer the part of your code ‘$path’ is using a single quote which is literal and show
Tag: bash
Add more new lines to end of line in stdout
I want to be able to print out my logs with extra new lines. This is what the logs look like They look much cluttered in the terminal and although there is a newline, I want to add 1 more newline to make it more readable. I tried using and to no avail. Answer Not entirely certain about portability, but
Linux bash script: How can I detect an error on a RESTORE DATABASE query on msssql-server?
Syncing a windows app with a linux website, I use a bash script which transfers each day a MS-SQL database from a Windows machine to a Linux installation, and uploads it to the mssql-server with the code below: Most of the times this line works perfectly. But there are instances in which restoration fails with an error like the following:
Is there any way to auto-send a “no” response to a script?
For example, I have this script: I can run yes | bash script and the script will automatically output “yes” I want to know if I can send a negative response to it and automatically output “no”. Sorry if this has been asked before but I can’t find anything related. Answer yes repeatedly outputs a string that you give it
Executing single shell script parallelly at same time with different arguments
Consider a script lets say test.sh which accepts file no as argument which process huge files based on argument. So whenever I am executing it as “nohup ./test.sh 01 &” it does the job, I have requirement where same needs to be executed parallelly for 8 files and I am able to achieve that with different arguments. Following are my
read the first line of a text file with JQ
Trying to see how I can read the first line of a text file using jq I have a text file with a bunch of ids (newfile.txt ) id like to be able to just read the first line with jq. I tried doing this But getting an error of I’d like to be able to read line by line
get multiple words after a specific word of HTML using linux/unix scripting
i have a file ‘movie.html’ : I want to get multiple word with pipe delimited like this: I tried this code: but the output isn’t as my expectation please help me, i am still a beginner Answer Parsing html with regex is not advised for several reasons (see https://stackoverflow.com/a/1732454/12957340), but here is one potential solution:
run multiple commands in docker after container start
how can I run /bin/run1.sh and /bin/run2.sh after the container startup! also, if you can tell me how can I send the logs of /bin/run1.sh and /bin/run2.sh to container logs!! Docker file entrypoint.sh run1.sh run2.sh Answer You can change ENTRYPOINT [“entrypoint.sh”] to ENTRYPOINT [“entrypoint.sh”, “run1.sh”, “run2.sh”] which will run your custom bash scripts you also need to create the log.txt
How to join command output lines into by separating then with n character [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I have below data which is just fetching the data which is 80 or more than 80% I am just
Nested bash loop runs but logic is not correct
I have this nested bash for loop where the first loop represents the range of servers, and the second loop reads each lines of the .txt file. Then will do a zgrep -i and find for a string on the matching line. keys.txt is as follow: Bash Loops: This runs but its logging every instance where ‘InitialRequest’ is defined. What