It’s very easy to iterate over lines of standard output of command. Read More
If you want to make your program working even if ssh session is close, you can use following command:
nohup program > output
If you close SSH session (or terminal), program will be still executed and standard output of program will be send to output file.
I’m sorry that I haven’t written for such a long time. It’s going to change:)
We have a program, which can suspend our terminal. We want to be sure, that program won’t be executed for more than n seconds. Here is a solution:
((sleep 10 && killall top)&); top
Explanation:
sleep 10 is executed for 10 seconds and then exit (you can use sleep n if you want sleep to be executed for n seconds
killall top terminates all processes named “top”
top - is example of program; top shows information about processes in your system
command1 && command2 – executes command1 and then, if command1 has succedeed, command2
command & – executes command at the background of terminal
command1; command2 – executes command1 and command2, even if command1 hasn’t succedeed
I’m presenting here some text file manipulation commands with examples of usage. I want to enlarge on cat, tac, uniq, sort, head, tail, tr, wc and cut. Read More
There are two files (for example called „f1” and „f2”). We want to swap contents of these files. Here is an easy bash script, which solves this problem:
#!/bin/sh # Created by Wojtek Jamrozy (www.wojtekrj.net) mv $1 cop_$1 mv $2 $1 mv cop_$1 $2
swap (93 bytes, 609 hits)