Wednesday 15 August 2012

bash/shell read LINE more than once -


I have a #! / Bin / sh is the script where I need to read pipe input more than once.

The way I am running it, it starts leaving, for example the following;

  while reading the line; Do echo "$ LINE" when reading the line; When called from    search / desktop, then "## $ LINE" echo it   

./my.sh

  - /Users/me/Desktop/some.txt - / user / mine / desktop / other txt   

and not

  - /Users/me/Desktop/some.txt - /Users/me/Desktop/other.txt##/users/im/desktop/smart.txt # # / Europe / IM / DSKTOP / Other .text   

Can I preserve this input if I want to use more than this one Su?

Thank you.

You have to save the input yourself.

  #! / Bin / sh i = 0; While reading the line; LINES [$ i] = "$ {LINE}" I = $ ((i + 1)) to enter "$ {LINES [@]}"; Sample output: "dunk" - $ {ENTRY} "## $ {ENTRY}" for ENTRY in "$ {LINES [@]}".   

Sample output:

  ls / bin / b * ./test.sh - / bin / basename - / bin / bash ## / bin / basename ## / bin / bash    

No comments:

Post a Comment