LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
LinkBack Search this Thread
Old 03-03-2012, 07:59 PM   #1
destinytia1
LQ Newbie
 
Registered: Mar 2012
Posts: 6

Rep: Reputation: Disabled
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...
 
Old 03-03-2012, 08:29 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
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
 
Old 03-03-2012, 09:21 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,806

Rep: Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923
Is it my imagination, or is this the same as this thread.
Was duplicated several times, now a duplicated userid maybe ?.
 
Old 03-03-2012, 09:27 PM   #4
destinytia1
LQ Newbie
 
Registered: Mar 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
please help me about these...
 
Old 03-03-2012, 10:49 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
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.
 
Old 03-03-2012, 11:34 PM   #6
destinytia1
LQ Newbie
 
Registered: Mar 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
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?...
 
Old 03-04-2012, 01:36 AM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
I'll just point you back at the first link in my first post in this thread ...
 
Old 03-04-2012, 01:31 PM   #8
prowla
Member
 
Registered: Feb 2011
Location: UK
Distribution: RHEL 5 & 6, Ubuntu 10
Posts: 91

Rep: Reputation: 3
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".
 
Old 03-07-2012, 01:11 AM   #9
destinytia1
LQ Newbie
 
Registered: Mar 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
@Prowla

how about if i will pass the options -l and -u ... where i cant start to code these in my script?? ms. prowla??
 
Old 03-07-2012, 02:32 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Quote:
Originally Posted by destinytia1 View Post
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
 
Old 03-08-2012, 01:54 AM   #11
prowla
Member
 
Registered: Feb 2011
Location: UK
Distribution: RHEL 5 & 6, Ubuntu 10
Posts: 91

Rep: Reputation: 3
Quote:
Originally Posted by destinytia1 View Post
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?
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to put custom text on Terminal (bash script) ? lupusarcanus Linux - Newbie 11 01-19-2010 07:29 AM
Handling null options in a bash script which ought to have a value dairo Linux - General 2 03-16-2009 12:27 PM
Script: put the output of a command into a variable. poincare999 Programming 4 11-04-2007 11:53 AM
bash script: making options? johngreenwood Programming 4 01-04-2007 01:55 PM
Bash put script jnusa Programming 3 09-07-2004 02:31 AM


All times are GMT -5. The time now is 03:59 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration