Solved

Run setup.sh when BASH shell starts.

Posted on 2004-10-14
5
1,169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 21

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

690 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