Please give your inputs !!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please give your inputs !!!!
# 8  
Old 04-26-2007
Quote:
Originally Posted by cfajohnson

Shorter (but not by much), slower (2 unnecessary external commands), and incorrect for the sample given:

Code:
lo0 127.0.0.1
ce0 10.177.4.61
groupname ether


True its not the fastest solution but ifconfig wouldn't have 1000s of lines of output so I would say it won't hurt but thanks for the point.
# 9  
Old 04-26-2007
Quote:
Originally Posted by Deal_NoDeal
True its not the fastest solution but ifconfig wouldn't have 1000s of lines of output so I would say it won't hurt but thanks for the point.

The difference will be more noticeable with a small amount of data, since the external commands will take a much greater percentage of the total time.

The extra time taken is not much on its own, but snippets of code are often incorporated into larger scripts. The inefficiencies of such code will be multiplied when there are a number of them in a script, especially if they are in a loop.

The more important issue in this case is that the output of the command is incorrect.

Last edited by cfajohnson; 04-27-2007 at 01:26 PM..
# 10  
Old 04-27-2007
Quote:
Originally Posted by cfajohnson

The difference will be more noticeable with a small amount of data, since the external commands will take a much greater percentage of the total time.

The extra time taken is not much on its own, but snippets of code are often incorporated into larger scripts. The innefficiencies of such code will be multiplied when there are a number of them in a script, especially if they are in a loop.

The more important issue in this case is that the output of the command is incorrect.
Looks correct on my system. But based on his "ifconfig", you are right.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inputs argument for sh -c

I have doubts with the following command: % find "$1" -name "*.html" -print0 | sort -zn | xargs -r -0 -n 1 sh -c 'echo "Dumping file: $2" >> "$1"; w3m "$2" >> "$1" 2>&1 ' sh "$2" I have doubts in the input arguments value i.e. $0, $1, $2... Step by step: 1.- % find "$1" -name "*.html"... (10 Replies)
Discussion started by: puertas12
10 Replies

2. Shell Programming and Scripting

Taking inputs on prompt

need a help to get a script: bash # ./xx.sh >> count 567 script will run the xx.sh and it will go to >> then run "count" will get the result "567" and print it (7 Replies)
Discussion started by: Aditya.Gurgaon
7 Replies

3. Shell Programming and Scripting

Read variable inputs

I am trying to make an interactive script. Only problem my inputs are not read and correctly channeled. Please help: Here is my code #!/bin/sh PATHSCRIPT=/home/pp/tmp #if ; then # echo "Syntax : $0 input off lat sample" # exit 1 # fi echo "Choice of Graph" echo "1 -- Type... (5 Replies)
Discussion started by: newkid.7955
5 Replies

4. Shell Programming and Scripting

Give inputs externally to awk script

Hello to all, Please some awk expert could help me. If I want to run an awk script as "command" give it inputs externally I do: Script.sh Input="$1" # "$1" is the input that will be given to the script Output=${Input%.*}.csv awk '{$1=$1}1' $Input | awk '{...}' > $Output and I run the... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

5. UNIX for Dummies Questions & Answers

How to give multiple inputs to a shell script

Got struck while trying to write a shell script which should automatically give input. While running a script for eg: (adpatch.sh) It Prompts for Multiple inputs like: Do you currently have files used for installing or upgrading the database installed in this APPL_TOP ? need to give... (2 Replies)
Discussion started by: abdmoha
2 Replies

6. Programming

Handling variable inputs

Hi, Is there any way to handle variable inputs. If an application handles more than one input how to print the input values. Example : ./a.out 1 "hi" 3 ./a.out 1 ./a.out 1 3 4 "hello" output should be: 1 hi 3 1 (1 Reply)
Discussion started by: yhacks
1 Replies

7. Shell Programming and Scripting

Check for numeric inputs

Hi All, How do i modify the below script such that if the input is numeric, it will give the numeric digit, else it will ouput "0" echo "xxx" | awk '/^+$/' (6 Replies)
Discussion started by: Raynon
6 Replies

8. Shell Programming and Scripting

Validating inputs from a file

Hi, I have a file called inputs. Now that file has the values like this: 1 2 3 Now In my script called 'get.sh' I do this : exec < inputs read a b c d Now I know that there will not be any value in d. How can I check it. I need the exact condition for checking whether the variable has... (1 Reply)
Discussion started by: sendhilmani123
1 Replies

9. Shell Programming and Scripting

Inputs from a file

Hi, I have a shell script that has to taken inputs from a file say "Inputs". Now I take 2 inputs at a time. Suppose the Inputs file contains numbers like 2 3 4 5 Now I have a written a script for adding 2 numbers. When I run the script for first time 2 and 3 must be the inputs. When i run the... (4 Replies)
Discussion started by: sendhil
4 Replies

10. Shell Programming and Scripting

Multiple Inputs

Have tried the search, but nothing resembles what I'd like to accomplish. I am attempting to write a script that will allow the user to input a list of data at the command prompt, then the data is used by another script for processing. I am allowing the user a list of 10 members in order to... (4 Replies)
Discussion started by: douknownam
4 Replies
Login or Register to Ask a Question