LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-17-2012, 07:18 PM   #1
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Rep: Reputation: Disabled
new command utility


is there a command utility that the options is not explored yet by the command??
that were not explored by the command yet, then
enhance the command by reinventing its name and adding this option
to its current options.

You may combine related commands into one script also.
Example:
copyormovefile (-c -m) filename/s
where:
copyormovefile is the name of the utility
(-c -m) are options that will do the following:
-c for copying filename/s
-m for moving filename/s

can anyone help please
 
Old 02-17-2012, 07:41 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Ummm ... what exactly is your question?
 
Old 02-17-2012, 07:50 PM   #3
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
what is the command utility that their options is not yet explored yet... can you suggest some utility?

---------- Post added 02-17-12 at 07:51 PM ----------

sir, when i will start my script in here, can you give me some guide to do it, please
 
Old 02-17-2012, 07:53 PM   #4
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
How about when i reinvented the command utility like:

cutorpaste

---what options can i put in here, and how can i enchance this options , can you guide me sir...
 
Old 02-17-2012, 07:57 PM   #5
Roken
Member
 
Registered: Oct 2011
Location: Bolton, UK
Distribution: Arch local, Debian on VPS
Posts: 258

Rep: Reputation: 41
I think you are talking about aliases - where you assign a command to an alias to reduce typing. Alternatively, you may be talking about writing a script to invoke a particular command (or series of commands) in a manner (or manners) specific to your requirements.

I'm with Tinkster on this, I'm not entirely sure what you are asking.
 
Old 02-17-2012, 08:02 PM   #6
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
yeah your right sir, aliases... i want to add a new options that never explored yet by cutorpase... By the way sir, my "cutorpaste" is my invented command utility,
for example
cutorpaste (-c -p)

-c => use to cut some content in a file
-p => used to paste some content of a file...

i need also to enhance these, what will i do ??
 
Old 02-17-2012, 08:07 PM   #7
Roken
Member
 
Registered: Oct 2011
Location: Bolton, UK
Distribution: Arch local, Debian on VPS
Posts: 258

Rep: Reputation: 41
If i understand you correctly, the way to do what you want is to create a script to do it. For example, I use a command line script to change my volume:

Code:
#!/bin/bash
# simple script to mute by changing volume
com=$1
VOL=`ossmix -D pcm | sed 's/.*to \(.*\)\:.*/\1/'`
echo $VOL
if [ "$1" = "up" ]; then 
#	amixer set Master 2+
	VOL=`echo $VOL+1 | bc`
echo $VOL
	ossmix pcm $VOL
fi
if [ "$1" = "down" ]; then 
#	amixer set Master 2-
	VOL=`echo $VOL-1 | bc`
	ossmix pcm $VOL
fi
if [ "$1" = "mute" ]; then 
#	amixer set Master 0
#	cur=`ossmix misc.front-mute | sed 's/^.*set to //'`
#	if [ "$cur" = "OFF" ]; then
#		cur="ON"
#	else
#		cur="OFF"
#	fi
	ossmix pcm 0
fi
Now I just call the command with:

Code:
volumecontrol up
volumecontrol down
volumecontrol mute

You can do similar with any command, then provided the script is executable and in your $PATH you have your own customised command.

Last edited by Roken; 02-17-2012 at 08:10 PM.
 
Old 02-17-2012, 08:19 PM   #8
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
sir what is your command utility that you used in your script, did you reinvent also its name and customized it in your $PATH??

Last edited by soniaholly1; 02-17-2012 at 08:27 PM.
 
Old 02-17-2012, 08:21 PM   #9
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
sir about the $PATH , how can i customized my "cutorpaste" command... sorry for asking many questions... because im a newbie here , and i want to learn.. thanks sir for helping...
 
Old 02-17-2012, 08:27 PM   #10
Roken
Member
 
Registered: Oct 2011
Location: Bolton, UK
Distribution: Arch local, Debian on VPS
Posts: 258

Rep: Reputation: 41
OK - your question is probably a much bigger question than you realise. Using scripts you can customise almost anything, but you have to know how to do that. I recommend that you do some reading first to learn the basics. We can help you better when you understand what you are doing. Start here: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
 
Old 02-17-2012, 08:54 PM   #11
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
ok sir thanks i will try these one... thanks sir for concern...
 
Old 02-17-2012, 09:05 PM   #12
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
sir did you use your own utility in your example script??... or its already built- in
 
Old 02-18-2012, 04:44 AM   #13
Roken
Member
 
Registered: Oct 2011
Location: Bolton, UK
Distribution: Arch local, Debian on VPS
Posts: 258

Rep: Reputation: 41
The script I posted as an example was one I'd written myself (and not a particularly good script example if I'm honest). It was intended to show you what a script looks like and how, by using scripts, you can simplify commands or, by combining different commands, you can create new ones to perform your own custom actions as you have suggested. For example, each of the commands `cut` and `paste` exist in linux, but there is no `cutorpaste` command. By writing a script you could combine the functionality of the two commands into a single script, which you would call 'cutorpaste', and you would design the script in such a way that it uses the commands in the way that you want.

As I said, though, bash scripting is a very big subject, and you should ideally learn the basics first.
 
Old 02-19-2012, 09:22 PM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Indeed, you should bookmark these:
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

If you read that lot, you'll be an expert

Anyway, you can invent your own cmd and its options by writing a script/prog in the language of your choice.
 
Old 02-20-2012, 01:59 AM   #15
soniaholly1
LQ Newbie
 
Registered: Feb 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
Sir Roken

sir i didnt get it, sir can you do it with its simplicity and i will enchance it furthermore... please please T_T
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Verve Command Line Utility metallica1973 Linux - General 3 01-13-2011 07:32 PM
command line disk partition utility Skaperen Linux - Software 5 01-11-2011 07:30 AM
command line setup utility sikkalgopal Mandriva 3 09-14-2004 01:41 PM
Where is Command line utility for Cups and command tutorial mossy Linux - Software 8 01-16-2004 01:24 AM
Command line utility costasm Linux - Software 1 10-24-2003 10:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:22 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration