Forum: Shell Scripting 6 Days Ago |
| Replies: 1 Views: 233 The Unix shell does not use set to assign values to variables.
Please put code inside [code] tags as I have done below.
That is not a valid command in a Unix shell script. |
Forum: Shell Scripting Nov 1st, 2009 |
| Replies: 1 Views: 635 Put the function call into the background:
timer "00:00:10" &
Please put code inside tags, as I have done above and below, and indent it for legibility. |
Forum: Shell Scripting Oct 19th, 2009 |
| Replies: 2 Views: 720 Please use CODE tags.
Why two cats?
cat $fname > output.dat |
Forum: Shell Scripting Oct 7th, 2009 |
| Replies: 1 Views: 628 You are missing ;; before 2) on line 168 or thereabouts and in many other places. |
Forum: Shell Scripting Oct 4th, 2009 |
| Replies: 2 Views: 834 sed 's/(see: \([^)]*\))/[[\1]]/' |
Forum: Shell Scripting Oct 4th, 2009 |
| Replies: 2 Views: 800 password=boom
n=0
for n in 1 2 3
do
read -ep "Code: " code
[ "$code" = "$password" ] && break
done
if [ "$code" = "$password" ]
then |
Forum: Shell Scripting Sep 27th, 2009 |
| Replies: 2 Views: 608 Note that the -i option to sed is not standard, and many versions do not have it.
Those that do either require or can take an argument with a backup suffix to save the original file -- a good... |
Forum: Shell Scripting Sep 23rd, 2009 |
| Replies: 6 Views: 819 They are three lines because the backslash is not the last character on the line; that's a carriage return.
If the backslash were the last character on the line, grep would still read it as three... |
Forum: Shell Scripting Sep 23rd, 2009 |
| Replies: 6 Views: 819 Search for what is actually there: a backslash followed by a carriage return. |
Forum: Shell Scripting Sep 23rd, 2009 |
| Replies: 6 Views: 819 It works for me.
Did you create the file on a Windows box? If so, there will be a carriage return before the newline, and the backslash will therefore not be the last character on the line. |
Forum: Shell Scripting May 28th, 2009 |
| Replies: 2 Views: 1,411 case $1 in
-o) shift ;;
*) set -- /dev/stdin ;;
esac
while IFS= read -r
do
: do whatever with "$line"
done < "$1" |
Forum: Shell Scripting May 24th, 2009 |
| Replies: 2 Views: 5,253 If you want to slow down the loop increase the argument to sleep, don't call an external command for integer arithmetic.
icon_num=$(( $icon_num + 1 ))
That's a very complicated script for a... |
Forum: Shell Scripting May 24th, 2009 |
| Replies: 2 Views: 2,991 echo "[1;4;31mSyntax[0m: sln <start[-end]> < file > [ <file> ]"
'for file in $*' will fail if any filenames contain spaces. Use:
for file in "$@" |
Forum: Shell Scripting Jan 25th, 2009 |
| Replies: 5 Views: 1,751 You don't need ls.
You don't need basename (an external command).
Your script will fail if any filenames contain spaces, because you haven't quoted "$line" and "$(basename $line .done)"
... |
Forum: Shell Scripting Jan 25th, 2009 |
| Replies: 9 Views: 1,209 Calling sed six times???? AARRGGHH!!!
If you know there are going to be six lines (or only need the first six):
{
read obyte1
read rbyte1
read snapt1
read obyte2 |