find ... | while read -r dir
do
something with "$dir"
done
Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts
Friday, 25 April 2014
for loop with spaces
I used to use a "for"-loop over a result of a `cat file` in order to apply on each line. But this does not work very well with spaces... Therefore I looked for a better solution which I kept forgetting. The trick is to use the "read command a in the example below:
Labels:
bash,
for loop,
while loop
Saturday, 30 June 2012
Useful to open firefox files under cygwin
I use cygwin extensively under windows. So I often need to open urls in firefox or in some other client. I finally found a was to implement this with simple alias and a bash function. It took me sometimes, but I guess or hope I learnt some thing.
You only need to put this in the .bashrc file or equivalent.
alias firefox='defCommand "/cygdrive/c/Program\ Files\ \(x86\)/Mozilla\
Firefox/firefox.exe"'
function defCommand(){
PARAM=`cygpath -m $2`
NEW_COMMAND="$1 file:$PARAM";
eval $NEW_COMMAND
}
Sunday, 24 June 2012
Script and scriptreplay for recording and replaying a bash session
http://linux.byexamples.com/archives/279/record-the-terminal-session-and-replay-later/ is a page explaining the use of script and scriptreplay in order to record a bash session and play it again. I really find this very useful, though I do not really use it very often. But perhaps using this tutorial, I will manage to use it.
Labels:
bash,
record session,
script,
scriptreplay
Subscribe to:
Posts (Atom)