LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-18-2006, 05:35 PM   #1
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Rep: Reputation: 30
Unusual piece of bash script code


I am no bash scripting enthusiast and try to get by with the bare minimum
necessary to perform some minor useful functions. I am fairly familiar with
piping 'grep', 'awk (or gawk)' and other minor tools to achieve the result
I want. However, I am somewhat befuddled by the following:

WANADDR=`/sbin/ifconfig $WANDEV | grep 'inet addr:' | awk '{print $2}' | cut -c6-20` set -- $WANADDR A="$1" B="$2" C="$3" D="$4"

The first part of the code included in the backtiks `` is understandable but the
final part, the set command, makes no sense to me. It also doesn't work.

Can anyone explain what is going on here or what someone has attempted to do?
 
Old 03-18-2006, 06:47 PM   #2
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
In BASH, set will enable or disable options to the currently running shell. I have no idea (since I don't know the context of the script) what the original intent was, and can't fathom what the author could've been trying to do.

Regards,

Alunduil
 
Old 03-18-2006, 10:49 PM   #3
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Original Poster
Rep: Reputation: 30
Well thanks! That was helpful!

What would you say if $WANDEV evaluated to 'eth0' and $1, $2 & $3 were to
represent the first three parts of an IP address?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
nice piece of code ....HOW DOES IT WORK? deadhead Programming 7 12-07-2003 12:52 AM
Bug in c code calling bash code Linh Programming 11 08-12-2003 04:27 AM
bash script - incrementing a filename in a script tslinux Programming 10 08-05-2003 11:58 PM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 05:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration