Top "Bash" questions

For questions about scripts written for the Bash command shell.

How to do a recursive find/replace of a string with awk or sed?

How do I find and replace every occurrence of: subdomainA.example.com with subdomainB.example.com in every text file …

bash sed awk replace
Get current time in seconds since the Epoch on Linux, Bash

I need something simple like date, but in seconds since 1970 instead of the current date, hours, minutes, and seconds. date …

linux bash datetime
Changing default shell in Linux

How is it possible to change the default shell? The env command currently says: SHELL=/bin/tcsh and I want …

linux bash shell environment tcsh
Replacing some characters in a string with another character

I have a string like AxxBCyyyDEFzzLMN and I want to replace all the occurrences of x, y, and z with _. …

string bash
How to wait in bash for several subprocesses to finish and return exit code !=0 when any subprocess ends with code !=0?

How to wait in a bash script for several subprocesses spawned from that script to finish and return exit code !=0 …

bash process wait
Given two directory trees, how can I find out which files differ by content?

If I want find the differences between two directory trees, I usually just execute: diff -r dir1/ dir2/ This outputs …

linux bash shell unix diff
How do I use shell variables in an awk script?

I found some ways to pass external shell variables to an awk script, but I'm confused about ' and ". First, …

bash shell awk
Find and kill a process in one line using bash and regex

I often need to kill a process during programming. The way I do it now is: [~]$ ps aux | grep 'python …

regex bash terminal awk
How to insert a new line in Linux shell script?

I want to insert a new line between multiple echo statements. I have tried echo "hello\n", but it is …

linux bash newline
./configure : /bin/sh^M : bad interpreter

I've been trying to install lpng142 on my fed 12 system. Seems like a problem to me. I get this error […

linux bash shell newline