Search Results

Showing results 1 to 18 of 18
Search took 0.01 seconds.
Search: Posts Made By: stilllearning ; Forum: Shell Scripting and child forums
Forum: Shell Scripting Dec 4th, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
The '|' character is a pipe. Basically what it does is send the output of one command which would otherwise go to stdout, in as the input to the next command.

The final sort and print doesn't...
Forum: Shell Scripting Dec 4th, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
Sorting a delimited file

for example if your record is and you want to sort it by the 3rd field,

a:b:c

sort -t':' -k 3

To sort it in numeric order add a -n to the line
Forum: Shell Scripting Dec 4th, 2007
Replies: 5
Views: 1,111
Posted By stilllearning
The while loop was pseudocode to give you an idea of what you might need. I am sorry if I confused you.

Check out this tutorial (http://www.linuxcommand.org/writing_shell_scripts.php), that...
Forum: Shell Scripting Dec 4th, 2007
Replies: 5
Views: 1,111
Posted By stilllearning
One way to do it, also assuming know how many instances of it you want to run, is in a loop, start the process in the background.

while (x < counter){
./process&
x++;
}
Forum: Shell Scripting Dec 4th, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
You could make this much easier :)

Once you have your output file with the values, all you really need to do is cat the output and pipe it into the sort. <Check the man pages for the sort and...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
Position works the same way as name does. You need to get the final field which is the position for that particular id, and not for a character string at the end of the line. That'll get you all the...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
I usually declare the arrays at the top of the script.

Something like this perhaps ? It uses 2 arrays one to store the names and the other to store the sales values.

I am not sure why your awk...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
You have the correct idea, but a couple of things.

1. When you extract the name from the associates file you also need to use the ID as a pattern to get the correct name.

2. You can declare the...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
Well, in basic bash scripting you cannot add floating point numbers, and i assume your price is floating point.

So in order to add those numbers you need the bc command to do this, hence the...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
It will be easier for you to debug this, if you break it up into smaller scripts to make sure each part is being done correctly.

A couple of things. $$ is usually the process id of -bash, so you...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
You accidentally removed the $ before the QUANT. Put that back in, and you'll be fine.
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
Your syntax errors are because of these 2 lines.

TOTAL=${echo "scale=2; $PRICE*QUANT" | bc)
echo "Associate 2$ID made $TOTAL for selling $PRODID


They should be (Need a ( bracket in line 1 ...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,379
Posted By stilllearning
Ok, I think this is roughly what you are looking for. You will still need to fine tune it to get the final answers you need. Some parts are hard coded, like assuming your associate id's range from 21...
Forum: Shell Scripting Nov 22nd, 2007
Replies: 3
Views: 1,504
Posted By stilllearning
The shell is basically a program that takes your keyboard input, usually at a command prompt and gives it to the operating system to process it. You can also put shell commands into a file and...
Forum: Shell Scripting Nov 22nd, 2007
Replies: 4
Views: 950
Posted By stilllearning
This is a basic bash scripting tutorial http://www.linuxcommand.org/writing_shell_scripts.php I found which is quite helpful, and takes you through simple scripting step by step. This explains shell...
Forum: Shell Scripting Nov 22nd, 2007
Replies: 2
Views: 664
Posted By stilllearning
This is interesting, and I was able to solve it using a couple of passes with pipes. For me its just easier to break it up into the steps that you explained and go through them one by one, and use...
Forum: Shell Scripting Nov 22nd, 2007
Replies: 6
Views: 2,249
Posted By stilllearning
With bash if you are typing on the command line you can just type

$ expr 2 + 4
6

If you are putting it in a file, you can do

#! /bin/bash

expr 2 + 4
Forum: Shell Scripting Nov 22nd, 2007
Replies: 0
Views: 1,022
Posted By stilllearning
Hello,

I need to figure out the sizes of different data types in a bash script. I haven't been able to make it work with sizeof(), is there an alternative ?

Thanks a lot.
Showing results 1 to 18 of 18

 


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

©2003 - 2009 DaniWeb® LLC