Search Results

Showing results 1 to 15 of 15
Search took 0.00 seconds.
Search: Posts Made By: cfajohnson ; Forum: Shell Scripting and child forums
Forum: Shell Scripting 6 Days Ago
Replies: 1
Views: 233
Posted By cfajohnson
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
Posted By cfajohnson
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
Posted By cfajohnson
Please use CODE tags.



Why two cats?


cat $fname > output.dat
Forum: Shell Scripting Oct 7th, 2009
Replies: 1
Views: 628
Posted By cfajohnson
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
Posted By cfajohnson
sed 's/(see: \([^)]*\))/[[\1]]/'
Forum: Shell Scripting Oct 4th, 2009
Replies: 2
Views: 800
Posted By cfajohnson
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
Posted By cfajohnson
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
Posted By cfajohnson
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
Posted By cfajohnson
Search for what is actually there: a backslash followed by a carriage return.
Forum: Shell Scripting Sep 23rd, 2009
Replies: 6
Views: 819
Posted By cfajohnson
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
Posted By cfajohnson
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
Code Snippet: Spinner
Views: 5,253
Posted By cfajohnson
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
Posted By cfajohnson
echo "Syntax: 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
Posted By cfajohnson
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
Posted By cfajohnson
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
Showing results 1 to 15 of 15

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC