Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
Tag: bash
How to display only different rows using diff (bash)
How can I display only different rows using diff in a separate file? For example, the file number 1 contains the line: A file number 2 contains the following lines: How to make in the following happen? Answer a.txt: b.txt: Use comm: The command line options to comm are pretty straight-forward: -1 suppress column 1 (lines unique to FILE1) -2
How to gzip all files in all sub-directories in bash
I want to iterate among sub directories of my current location and gzip each file seperately. For zipping files in a directory, I use but this can just work on current directory and not the sub directories of the current directory. How can I rewrite the above statements so that It also zips the files in all subdirectories? Answer No
Bash – for i in cat?
I’m not a bash scriptor, so this is no doubt a very simple question. I have a bash script throwing an error. It looks like this: The error is on the second line, related to the curly brackets. So it seems curly brackets shouldn’t be here… in which case, what should line 2 look like? The script is supposed to
BASH – weird characters coming out from a pipe
I have this script which simply kills an app If I write the kill command manually as a oneliner than it works. But I have to run it as a script which doesn’t work. So I tried to debug it and here is the result Why do I keep getting those strange characters on the kill line? How can i
How to automatically snapshot a volume of an Amazon EC2 instance?
I’m trying a script to backup a volume automatically. I follow this EBS-Snapshot.sh script as found on github: I have the two files for X509 authentication, the instance ID but I don’t understand the script and how to parameterise the volume that I want to backup. I don’t understand the first line (source) and the EC2_BIN. With that configuration, it
Use grep to match a pattern in a line only once
I have this: Which gives this: I understand whats happening. How do I stop grep from trying to continue matching after 1 successful match? How do I get only Answer You need to do the grouping: (…) followed by the exact number of occurrence: {<n>} to do the job: Hope it helps. Cheers!!
Is wget or similar programs always available on POSIX systems?
Is there an HTTP client like wget/lynx/GET that is distributed by default in POSIX or *nix operating systems that could be used for maximum portability? I know most systems have wget or lynx installed, but I seem to remember installing some Ubuntu server systems using default settings and they had neither wget or lynx installed in the base package. I
Adding newline characters to unix shell variables
I have a variable in a shell script in which I’d like to format the data. The variable stores new data during every iteration of a loop. Each time the new data is stored, I’d like to insert a new line character. Here is how I’m trying to store the data into the variable. VARIABLE=”$VARIABLE ‘n’ SomeData” Unfortunately, the output
IFS usage in bash
I have I think I understand whats happening in 2nd and 4th for loops. But I do not understand why 1 was not printed in 1st and 3rd for loops. The whole idea of IFS is confusing to me in general. Answer When you say $var_name then 1 is interpreted as a separator and hence you see the string as