LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-28-2014, 09:27 PM   #1
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Rep: Reputation: 39
command syntax with bracket


Hi guys,
I have a question. Since we can create 2 files ac, bc like these
$touch {a,b}c
can we do something similar
$ethtool -k eth{0,1} tx off or some similar command possible ?

Thanks in advance.
 
Old 11-29-2014, 04:23 AM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by tanveer View Post
can we do something similar
$ethtool -k eth{0,1} tx off or some similar command possible?
it depends on how the command you're issuing handles its parameters. Actually, the braces {} just duplicate or triplicate a given parameter and then pass the expanded command line to the program being invoked. For example,
Code:
rm aa{p,sk,x}bb
would expand to
Code:
rm aapbb aaskbb aaxbb
That works because 'rm' is designed to deal with multiple file names in a single command. I'm not sure whether this works with ethtool. Reading the output of 'ethtool --help', I understand it the way that it takes only one interface name per call.

[X] Doc CPU
 
Old 11-29-2014, 10:41 AM   #3
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
Agreed with the theory given by DOC CPU. it always depend on how command handles its parameters, commands those allow multiple parameters may work with this concept but others could give you a bad dream or day and may be more disastrous if used negligently.
 
Old 11-29-2014, 01:17 PM   #4
Kenhelm
Member
 
Registered: Mar 2008
Location: N. W. England
Distribution: Mandriva
Posts: 360

Rep: Reputation: 170Reputation: 170
Spaces need to be escaped for some expansions.
Code:
# Use echo to check the expansion without running the command
echo ethtool -K\ eth{0,1}\ tx\ off
# Result:
ethtool -K eth0 tx off -K eth1 tx off
 
Old 12-03-2014, 11:57 AM   #5
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Original Poster
Rep: Reputation: 39
thanks for the replies, make sense.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The db2icrt command failed because the specified command syntax was invalid. gio.cot Red Hat 0 11-17-2014 02:44 AM
[SOLVED] run ps|grep command by script/command line ... ERROR: Unsupported option (BSD syntax) masuch Programming 4 05-23-2012 04:13 AM
ls command syntax Freestone Linux - General 5 03-20-2007 06:37 PM
Tcl/Tk Bracket Problems in Command Kenji Miyamoto Programming 0 06-26-2005 11:29 PM
command syntax Jeebizz Slackware 1 04-14-2005 10:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:16 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