Solved

Run setup.sh when BASH shell starts.

Posted on 2004-10-14
5
1,138 Views
Last Modified: 2012-06-21
I am sharing an account on a SUN unix box.  The owner of the account refuses to set a default shell.  When you first log in you have to start the desired shell.

Currently I am using the bash shell.  So when I login, I type the following:
  bash
  . ./setup.sh
(setup.sh initialises my personal aliases)

My question is:  Is there a way for me to do the same in one line?

In Windows shell I can do this by just typing CMD batfile.bat.
0
Comment
Question by:MogalManic
5 Comments
 
LVL 11

Expert Comment

by:avizit
ID: 12307420
you can type
 bash ../setup.sh

or source setup.sh  will work too i think

also read

read http:Q_10153144.html
0
 
LVL 20

Accepted Solution

by:
tfewster earned 125 total points
ID: 12309372
Why not copy the contents of setup.sh to .bash_profile?

Then, if you start bash with `bash --login`, it will execute your .bash_profile and set up the environment for you.

Or, have the command do `. ./setup.sh` in the .bash_profile.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 12312163
No need to type in anything.

Let's assume your default shell is /bin/sh, then in your .profile, put

[ -x /usr/bin/bash ] && exec /usr/bin/bash --login

And put the contents of setup.sh in your .bash_profile or call it from your .bash_profile
0
 
LVL 4

Expert Comment

by:pankajtiwary
ID: 12315674
If you are using bash shell, the easiest way to do this is open the .bash_profile in some editor, go to the last and in a new line type ../setip.sh
0
 
LVL 4

Expert Comment

by:pankajtiwary
ID: 12315681
MogalManic,
 Sorry for the typo, it should be ../setup.sh
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
error while running the scirpt 24 125
cant install flashplugins for firefox in freebsd 8 9 44
prtdiag report hdd failure 10 137
netstat -a in AIX unix 8 36
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now