LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need Help about dd command new options to put in bash script (https://www.linuxquestions.org/questions/linux-newbie-8/need-help-about-dd-command-new-options-to-put-in-bash-script-932589/)

destinytia1 03-03-2012 07:59 PM

Need Help about dd command new options to put in bash script
 
i have questions guys about dd command in bash script...

i want to put in bash script about the command dd command and i want to add a new options (-l -u) to put it in my script...

-l options to lower case the contents of file
-u options to upper case the contents of file...

so that whenever i will type in command line

dd -u if=file of=file.new

OUTPUT of file will become UPPERCASE all... vise versa in -l options...

how to this or what to put in bash script... someone please... I greatly appreciate your help...

Tinkster 03-03-2012 08:29 PM

Here's a starting point:
http://how-to.wikia.com/wiki/How_to_..._a_bash_script


And a follow-up:
http://tldp.org/LDP/abs/html/



Cheers,
Tink

syg00 03-03-2012 09:21 PM

Is it my imagination, or is this the same as this thread.
Was duplicated several times, now a duplicated userid maybe ?.

destinytia1 03-03-2012 09:27 PM

please help me about these...

Tinkster 03-03-2012 10:49 PM

We did .... the ball is back in your court. Read, learn, ... try stuff.

If you have problems (no, not the kind of where we solve your homework)
with execution, or run into errors come back and ask.

destinytia1 03-03-2012 11:34 PM

i want to implement in my script the (-u -l) options...

when i try to aliasing it to my .bash_profile

it cant what i type like:

alias -l='conv=lcase'
alias -u='conv=ucase'

and i export it...

then when i will typed in the command like :

dd -l if=file of=file.new and press Enter

it says that

option -l command not found...

so i want to put it in my bash script... but how?...

Tinkster 03-04-2012 01:36 AM

I'll just point you back at the first link in my first post in this thread ...

prowla 03-04-2012 01:31 PM

You can't add options to existing commands.

The alias command allows you to setup new names for existing commands, and optionally include options after the command name.

You can do alias ddl='/bin/dd conv=lcase' and alias ddu='/bin/dd conv=ucase'

If you want you can write a script "eg. myveryowndd" and have it parse the command line to take your "-l" option and pass it to dd as "conv=xxxxxx".

destinytia1 03-07-2012 01:11 AM

@Prowla
 
how about if i will pass the options -l and -u ... where i cant start to code these in my script?? ms. prowla??

Tinkster 03-07-2012 02:32 PM

Quote:

Originally Posted by destinytia1 (Post 4620533)
how about if i will pass the options -l and -u ... where i cant start to code these in my script?? ms. prowla??


Start reading ...
https://www.linuxquestions.org/quest...9/#post4617898

I don't know/can't fathom how much time you will waste on asking others
to do your work, just follow the first link in the post above; try to
understand what they do, and try to transfer it to your own situation.

If you have half a brain your goal should be achievable within 10-15
minutes of going there.



Cheers,
Tink

prowla 03-08-2012 01:54 AM

Quote:

Originally Posted by destinytia1 (Post 4620533)
how about if i will pass the options -l and -u ... where i cant start to code these in my script?? ms. prowla??

I gave you a way of using an alias.

If you want to write a script, then you could check out getopts for handling command line options in the standard way.

What is the background to your question?


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