ksh to bash mode


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh to bash mode
# 15  
Old 10-24-2008
Yep,
just tried this on an old Solaris machine and it works Smilie

Create an empty .bash_profile.
The existence of this file will prevent the exec'd bash from trying to
read ~/.profile, and re-executing itself over and over again.


Code:
touch "$HOME"/.bash_profile

2. Execute the following command:

Code:
printf "%s\n" '[ -x /usr/bin/bash -a "$PS1" ]&&exec  /usr/bin/bash --login'>>"$HOME"/.profile

Leave your current session open, start a new one (.profile is read only on logon, so if you open a new session from the same terminal, that won't work).

Last edited by radoulov; 10-24-2008 at 06:20 PM.. Reason: -l to --login
# 16  
Old 10-24-2008
Cool...
but b4 executing this, I want to make sure that we are getting step 2 right..
Are you trying to throw the o/p of step 2 to .profile or .bash_profile?..

I dont want to touch the existing profile...right?...

-Anduzzi
# 17  
Old 10-24-2008
You should modify the existing profile (note the >> append redirection).
I cannot get my old ksh88 to read .kshrc ...
That's why I added the test for interactive shell $PS1, to simulate the rc behavior.

You should:

1. Create an empty(for nowSmilie) .bash_profile.
2. Modify your existing .profile (make a backup copy first).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Fedora

Bash in Emergency Mode

I'm sure this is a really dumb question, but if I use a command in Fedora 23 emergency mode, and that command doesn't exist, I don't come back to the command prompt, but enter what appears to be a text mode. How do I get back to the command line? (2 Replies)
Discussion started by: bangorme
2 Replies

2. UNIX for Dummies Questions & Answers

New user in bash mode

when I created user and use su - username then its prompt come in bash mode # su - uusr -bash-4.1$ What is this bash mode . this also show -bash-4.1$ touch filename touch: cannot touch `filename': Permission denied Please use CODE tags (not ICODE tags) when displaying... (2 Replies)
Discussion started by: kaushik02018
2 Replies

3. Shell Programming and Scripting

tftp batch mode within bash script

Hi, I put the necessary tftp commands into a batch file and I can run tftp by $ tftp < tftpbatchscript in bash command line and then successfully exit. Now, I want to put a line which does the same thing above. However, when I put this line into a bash script, the lines below this line... (1 Reply)
Discussion started by: yildiz.a
1 Replies

4. Shell Programming and Scripting

set ksh script in restricted mode

Hi, I came across a post wherein you can use "set -r"(on bash) to activate restricted mode ( wherein you cant run some commands such as cd etc). Can anyone guide if we have anything similar in ksh ? Thanks (2 Replies)
Discussion started by: Shivdatta
2 Replies

5. Shell Programming and Scripting

BASH to KSH

I have a script in KSH and now need to incorporate this into another script which is in BASH. OUr script contains code like below in good number of places. Eg: echo “A B C” | read VAR1 VAR2 VAR3 This works only in ksh and not in BASH. Please let me know 1. Which is the equivalent... (3 Replies)
Discussion started by: cvsanthosh
3 Replies

6. UNIX for Dummies Questions & Answers

bash preferred or ksh with bash features

I'm a user on a fairly locked down sys V server. By default, I have ksh set as my default shell. I added to my .profile: bash -o vi so when I login, it goes into bash so I can take advantage of tab completion and use the up key to bring up previous commands. However, whenever I want to exit, I... (2 Replies)
Discussion started by: mrwatkin
2 Replies

7. Shell Programming and Scripting

bash and ksh: variable lost in loop in bash?

Hi, I use AIX (ksh) and Linux (bash) servers. I'm trying to do scripts to will run in both ksh and bash, and most of the time it works. But this time I don't get it in bash (I'm more familar in ksh). The goal of my script if to read a "config file" (like "ini" file), and make various report.... (2 Replies)
Discussion started by: estienne
2 Replies

8. UNIX for Dummies Questions & Answers

ksh in vi mode, choose from output

is there a way to choose the complement from the output from the sequense in "ksh -o vi" root# ls testa testb root# cat tes 1) testa 2) testb root# cat tes <-- what to do now? this output looks like a select function, otherwise the numbers wouldn't make sense, is there a chance to use... (2 Replies)
Discussion started by: pressy
2 Replies

9. Shell Programming and Scripting

python vs bash - verbose mode

hey all! i'm looking how to render verbose python scripts. what i'm looking for would be an equivalent to a "bash -xf" in bash script headers.. Any help? (2 Replies)
Discussion started by: penguin-friend
2 Replies

10. Shell Programming and Scripting

Ksh vs Bash

Hi Buddy, Can any one help me to overcome from the below problem? #/usr/bin/ksh typeset -Z dd dd=1 echo $dd =========== out put for the above is 01 same script I'm migrating to bash but typeset -Z option is not found in bash, Pls get me the equivalent option in BASH Thanks in... (1 Reply)
Discussion started by: krishna
1 Replies
Login or Register to Ask a Question