LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-01-2008, 12:40 PM   #1
tarqertil
LQ Newbie
 
Registered: Jul 2008
Posts: 1

Rep: Reputation: 0
Question How to create alias that runs a shell-script


With which command can I create an alias that will run a shell script (file with *.sh extension)?

I searched for the answer to this, but I think I don't know which are the right search-terms.
 
Old 07-01-2008, 12:57 PM   #2
markjuggles
Member
 
Registered: Nov 2003
Location: Chicago western suburbs
Distribution: Linux Mint
Posts: 75

Rep: Reputation: 15
Use the 'alias' command:

alias doit=InconvenientToType.sh

Assuming that the shell script is executable with its full name, it will also be executable with the alias (in this case, 'doit').

You can make it permanent by putting it in your .profile or .bash_profile.
 
Old 07-01-2008, 01:20 PM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986
The shell script must be in your PATH, unless you specify the full path in the alias itself.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script: want to insert values in database when update script runs ring Programming 2 10-25-2007 10:48 PM
Create new script that runs on startup pnellesen SUSE / openSUSE 1 01-23-2007 08:29 PM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
alias does not work in shell script mannahazarika Programming 9 01-20-2006 01:56 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:16 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
Open Source Consulting | Domain Registration