tagged [shell]
Is there a way to 'uniq' by column?
Is there a way to 'uniq' by column? I have a .csv file like this: I have to remove duplicate e-mails (the entire line) from the file (i.e.
Sorting data based on second column of a file
Sorting data based on second column of a file I have a file of 2 columns and `n` number of rows. column1 contains `names` and column2 `age`. I want to sort the content of this file in ascending order ...
How to convert a string to lower case in Bash
How to convert a string to lower case in Bash Is there a way in [bash](/questions/tagged/bash) to convert a string into a lower case string? For example, if I have: I want to convert it to:
How to sort a file in-place?
How to sort a file in-place? When we use the `sort file` command, the file shows its contents in a sorted way. What if I don't want to get any output on stdout, but in the input file instead?
Difference between single and double quotes in Bash
Difference between single and double quotes in Bash In Bash, what are the differences between single quotes (`''`) and double quotes (`""`)?
- Modified
- 24 May at 14:53
How to retrieve absolute path given relative
How to retrieve absolute path given relative Is there a command to retrieve the absolute path given a relative path? For example I want $line to contain the absolute path of each file in dir `./etc/`
Timeout a command in bash without unnecessary delay
Timeout a command in bash without unnecessary delay [This answer](https://stackoverflow.com/questions/601543#637753) to [Command line command to auto-kill a command after a certain amount of time](htt...
Convert line endings
Convert line endings I have been using `d2u` to convert line endings. After installing Puppy Linux I noticed that it does not come with `d2u`, but `dos2unix`. Then I noticed that Ubuntu is missing bot...
- Modified
- 22 May at 20:59
Grep 'binary file matches'. How to get normal grep output?
Grep 'binary file matches'. How to get normal grep output? I've got a grep script that searches through a directory recursively. However the results I get are the following. Notice there are found mat...
Running script upon login in mac OS X
Running script upon login in mac OS X I am wondering if anyone is able to help me out with getting a shell (.sh) program to automatically run whenever I log in to my account on my computer. I am runni...
- Modified
- 12 May at 20:27
How to check the exit status using an 'if' statement
How to check the exit status using an 'if' statement What would be the best way to check the in an `if` statement in order to echo a specific output? I'm thinking of it being: The issue I am also havi...
- Modified
- 1 May at 02:4
How to represent multiple conditions in a shell if statement?
How to represent multiple conditions in a shell if statement? I want to represent multiple conditions like this: but when I execute the script, it shows ``` syntax error at line 15: `[' unexpected, ``...
I get "dquote>" as a result of executing a program in linux shell
I get "dquote>" as a result of executing a program in linux shell When I execute a script in a Linux shell, I get this output: What does this mean?
Portable way to get file size (in bytes) in the shell
Portable way to get file size (in bytes) in the shell On Linux, I use `stat --format="%s" FILE`, but the [Solaris](https://en.wikipedia.org/wiki/Solaris_%28operating_system%29) machine I have access t...
Reading a space-delimited string into an array in Bash
Reading a space-delimited string into an array in Bash I have a variable which contains a space-delimited string: I want to split that string with space as a delimiter and store the result in an array...
Simulating ENTER keypress in bash script
Simulating ENTER keypress in bash script I've created a really simple bash script that runs a few commands. one of these commands needs user input during runtime. i.e it asks the user "do you want to ...
What is the purpose of the : (colon) GNU Bash builtin?
What is the purpose of the : (colon) GNU Bash builtin? What is the purpose of a command that does nothing, being little more than a comment leader, but is actually a shell builtin in and of itself? It...
Variables as commands in Bash scripts
Variables as commands in Bash scripts I am writing a very simple Bash script that [tars](https://en.wikipedia.org/wiki/Tar_%28computing%29) a given directory, encrypts the output of that, and then spl...
How can I execute a command stored in a variable?
How can I execute a command stored in a variable? What is the correct way to call some command stored in variable? Are there any differences between 1 and 2?
- Modified
- 3 Dec at 03:21
Shell command to find lines common in two files
Shell command to find lines common in two files I'm sure I once found a shell command which could print the common lines from two or more files. What is its name? It was much simpler than [diff](https...
- Modified
- 30 Nov at 16:10
Rearrange columns using cut
Rearrange columns using cut I am having a file in the following format I want the columns to be rearranged. I tried below command > cut -f2,1 file.txt The command doesn't reorder the columns. Any idea...
Difference between sh and Bash
Difference between sh and Bash When writing shell programs, we often use `/bin/sh` and `/bin/bash`. I usually use `bash`, but I don't know what's the difference between them. What's main difference be...
How can I debug a Bash script?
How can I debug a Bash script? Is there a way to debug a Bash script? E.g., something that prints a sort of an execution log, like "calling line 1", "calling line 2", etc.
Shell: How to call one shell script from another shell script?
Shell: How to call one shell script from another shell script? I have two shell scripts, `a.sh` and `b.sh`. How can I call `b.sh` from within the shell script `a.sh`?