LinuxQuestions.org
Visit Jeremy's Blog.
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
 
Search this Thread
Old 06-08-2004, 09:15 AM   #1
RickHunter_Ve
LQ Newbie
 
Registered: Jun 2004
Posts: 7

Rep: Reputation: 0
Smile How make a script in order to set global alias?


Hi all,

I want to make a script that set my personal alias.
I know if put them in my home ".bashrc" file must work, but i normally get into linux-box as other user and i want get this alias in all linux-box i logon.

I make a script as follow example:

alias TestImage='mount -o loop -t iso9660 image.iso Erase/'

but this not set enviroment alias when i execute it.

Anyone can help me with that?

Thanks a lot.
 
Old 06-08-2004, 09:28 AM   #2
phase9
Member
 
Registered: Mar 2004
Location: austria, vienna
Distribution: slackware-10.2
Posts: 89

Rep: Reputation: 15
Hi!

Try putting your alias into /etc/profile.
 
Old 06-08-2004, 09:35 AM   #3
RickHunter_Ve
LQ Newbie
 
Registered: Jun 2004
Posts: 7

Original Poster
Rep: Reputation: 0
thanks

thanks.

it's not possible "export" a alias from a script to global shell?
 
Old 06-08-2004, 10:12 AM   #4
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
No. There is no one global shell. Each use runs in his own personal shell.

The only way for each user to have an alias is for each user to execute a script (usually at login) that is sourced and creates the alias.
 
Old 06-08-2004, 10:41 AM   #5
RickHunter_Ve
LQ Newbie
 
Registered: Jun 2004
Posts: 7

Original Poster
Rep: Reputation: 0
thanks

ok.

What must say this script that set this alias in my personal shell?

When i run:

/home/personal/MyAlias.bsh

And,

########### /home/personal/MyAlias.bsh ########

alias FormatFloppy='fdformat /dev/fd0H1440; mkfs -t vfat -c /dev/fd0H1440'

############### End ###################

then if i use FormatFloppy in shell don't work.

any idea?

Thanks a lot.
 
Old 06-08-2004, 12:57 PM   #6
phase9
Member
 
Registered: Mar 2004
Location: austria, vienna
Distribution: slackware-10.2
Posts: 89

Rep: Reputation: 15
Hi!

Maybe the alias definition from MyAlias.bsh is created as a subprocess of the current shell. Then the aliases would not be available.


Another suggestion:

Why not make FormatFloppy a (bash)script. Make it executable and put it in your (systemwide)path.
This should then work in any shell/terminal.
 
Old 06-08-2004, 01:35 PM   #7
RickHunter_Ve
LQ Newbie
 
Registered: Jun 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by phase9
Hi!

Maybe the alias definition from MyAlias.bsh is created as a subprocess of the current shell. Then the aliases would not be available.
In this case can i do something, in order to MyAlias.bsh will be not created as subprocess?

Quote:
Originally posted by phase9
Another suggestion:

Why not make FormatFloppy a (bash)script. Make it executable and put it in your (systemwide)path.
This should then work in any shell/terminal.
Yes i think this will work.. thanks a lot.. what its primary systemwide in red hat?

Again thx. i keep in
 
Old 06-08-2004, 02:13 PM   #8
phase9
Member
 
Registered: Mar 2004
Location: austria, vienna
Distribution: slackware-10.2
Posts: 89

Rep: Reputation: 15
Hi!

Quote:
MyAlias.bsh will be not created as subprocess?
I don't know.


Quote:
what its primary systemwide in red hat?
As with Red Hat I can't say, but I think $PATH should be set in /etc/profile (as it would be done with Slackware).
 
  


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
How to set up a global address book using LDAP? coolamit78 Linux - Networking 1 04-04-2005 01:42 AM
Set Global variable for daemon without login RX100 Linux - Software 3 10-08-2004 08:50 AM
where to put global alias' true_atlantis Slackware 4 12-25-2003 02:31 PM
how do i set global prefs for bash polonius19 Slackware 2 03-06-2003 05:23 PM
Set-up order ?? Justinw Linux - Networking 3 04-20-2001 02:06 AM


All times are GMT -5. The time now is 07:03 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