Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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
Distribution: Arch, Debian, LFS (debian and LFS relegated to backups)
Posts: 182
Rep:
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.
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...
Distribution: Arch, Debian, LFS (debian and LFS relegated to backups)
Posts: 182
Rep:
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.
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...
Distribution: Arch, Debian, LFS (debian and LFS relegated to backups)
Posts: 182
Rep:
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
Distribution: Arch, Debian, LFS (debian and LFS relegated to backups)
Posts: 182
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.