Skip to content

Tag: bash

Extra backslash when storing grep in a value

In a bash script I have: When you run it it shows it as: Now it works exactly what I want but I want to understand it. Why is there 2 extra ‘s? Answer The output from set -x uses single quotes. So the outer double quotes were replaced with single quotes but you can’t escape single quotes inside a

Extract lines from File2 already found File1

Using linux commandline, i need to output the lines from text file2 that are already found in file1. File1: File2: Output: Thanks! Answer A more flexible tool to use would be awk Example What it does? NR==FNR{lines[$0]++; next} NR==FNR checks if the file number of records is equal to the overall number of rec…

Bash script to execute commands on system boot up

I am trying to make a bash script to check for two data values and weather or not they are set to 1 or 0 I want to do something. These values usually are set on system bootup and are defined usually after system is completely up (that is why I am using a while loop to keep checking until

Use Xargs to wait for enter key

So, I have a list of files that I want to use to generate a new set of groups of files. I want to open up these groups (multiple files) together at once. Edit them. Then go back to the terminal, hit enter, and open up the next group of files. I’ve got it working, but I’m using a temporary

Jenkins adding single quotes to bash shell script

My shell script looks like this: It’s checked into cvs in a shell folder, Jenkins is configured to execute it on a Linux machine via a job with ‘Execute Shell’ build step: But Jenkins is wrapping the whole sudo line in single quotes which results in my log files not been deleted (although th…

deletion of file after 7 days

I have to delete multiple files after 7 days regularly. And the deletion dates and location are different for each file.Yes, I can apply a cronjob for each folder separately but tat will involve many cronjobs (atleast 15). In order to avoid this, I want to create a script which will go to each folder and dele…

Difference on bash and ash parentheses

I was trying to use a diff command for comparing directory listings which works fine in bash: However, on the ash (embedded device where no other shell is available) I get Is there any difference regarding reading input operator < or parentheses ( )? Answer Don’t confuse the angle bracket in <( … …