LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 03:34 AM   #1
noir911
Member
 
Registered: Apr 2004
Posts: 682

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, 05: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



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 11 01-29-2016 01:09 PM
adding perm. alias to .bashrc Lleb_KCir Linux - General 7 12-09-2004 02:35 PM
My first alias in .bashrc...'apostrophes 'getting' in the way?' Baix Linux - Newbie 3 06-17-2004 02:36 PM
alias and .bashrc whaase Linux - General 3 11-02-2003 07:03 PM
alias and bashrc Haldir Linux - Newbie 3 06-14-2002 05:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:29 PM.

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
Open Source Consulting | Domain Registration