LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-22-2006, 04:34 AM   #1
noir911
Member
 
Registered: Apr 2004
Location: Baltimore, MD
Posts: 681

Rep: Reputation: Disabled
bashrc alias issue


I have this alias in my .bashrc

alias burncd='cdrecord -v -pad dev=/dev/sdb $1'

it takes $1 as the file name to be burned. I was wondering how I could write it such that if someone forgets to give the name of the file, it will display "Error: please give the file name"

something like this -

$ burncd
Error: please give the file name to be burned.
 
Old 08-22-2006, 06:24 AM   #2
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
You can use a function instead of an anlias:
Code:
function burncd {
    if [ ! -r "$1" ]
    then
      echo "Error: please give the file name"
      return 1
    fi
    cdrecord -v -pad dev=/dev/sdb "$1"
}
 
  


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
using 'watch' on an alias in .bashrc slackist Linux - General 9 01-03-2005 01:52 AM
adding perm. alias to .bashrc Lleb_KCir Linux - General 7 12-09-2004 03:35 PM
My first alias in .bashrc...'apostrophes 'getting' in the way?' Baix Linux - Newbie 3 06-17-2004 03:36 PM
alias and .bashrc whaase Linux - General 3 11-02-2003 08:03 PM
alias and bashrc Haldir Linux - Newbie 3 06-14-2002 06:11 PM


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