Skip to content
Advertisement

Tag: bash

Getting curl: (3) URL using bad/illegal format

My bash code is simply this. I am trying to learn docker but also a newbie with bash scripting. I type in something simple like google.com for the read command but it gives me curl: (3) URL using bad/illegal format or missing URL. Anyone know what I am doing wrong? docker exec -it missingDependencies sh -c “echo ‘Input Website:’; read

Linux Shell Script – Mounting and Backing Up Files

I’m writing my first shell script. I want to check if a filesystem is mounted. If so, then backup the documents from my main drive to the backup that is mounted. If not, mount the filesystem, then backup the documents. I executed the script, yet all I got was a lot of text. It didn’t perform as I wanted. Did

How to use error validation in Bash for checking an entry in a file

If there is no entry of that species name in the file how do I give the user an error to say not found? Answer The answer to your immediate question is to examine the exit code from grep. But probably also refactor the loop: A better design altogether is probably to make the search term a command-line argument. This

Remove set of special chars from a string using bash script

I need to search for the file path ending with *Tests.cs having multiple directories. I need to display all the file path in spaces instead of new line. Currently, it is displaying as How to remove ./ from each file path and display it as follows? My bash script is: Answer If your structure is consistent as in the example,

run a command with a file pattern

I have this file patterns.txt And I want to run a specific command for every pattern like this: I tried to used for loop like this: but i didn’t work Answer The 2 typical approaches are: and Note that I would expect both of those to fail, since scp expects at least 2 arguments. How you want that 2nd argument

Grandchildren and Great-grandchildren of a process

I am trying to get the grandchildren and grand grandchildren PID’S of a certain PID that I pass as an argument. So, I am trying to find the simplest solution possible for a beginner. Now, I used pgrep -P $pid, to find the children of a certain PID, but now that I want to go even deeper, I think I

Advertisement