Unix command line question


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unix command line question
# 1  
Old 09-17-2010
Unix command line question

I'm new to Unix and I'm looking for some assistance. We have 20 different accounts we must login to every day. Logging in has become quite the chore and most nights, we have to log out. I'm looking for a way to simply copy and paste the commands into each window to make things easier.
I have been using the following to log in every time: different 20 different accounts across three servers.

Code:
$ su - account
Password
$cd /home/i5/i5.4/release/account
$. ./profile.ksh
whoami: not found
$. ./profile.ksh
$bash
$PS1='Account1:'
Account1:

I am trying to combine these all on one line. That way I just copy and paste the entire line to save time. When I do however, my prompt does not change.
Code:
$cd /home/i5/i5.4/release/account; . ./profile.ksh; . ./profile.ksh; bash; PS1='Account1:'
bash$

I'm not even certain the second ././profile ran, although I'm pretty sure it did. What did not run though is the change of my prompt. Would someone help so I can only copy and paste one line to have all of the commands run? If there is an easier way to automate this, please let me know.

Last edited by Scott; 09-17-2010 at 05:03 PM.. Reason: Added CODE tags, removed formatting
# 2  
Old 09-17-2010
Have you tried with "&&"?

Code:
cd /home/i5/i5.4/release/account && . ./profile.ksh && . ./profile.ksh && bash && PS1=’Account1:’

To save to some work in the future you should look into using screen with ssh for these multiple logins.

Using GNU Screen to Manage Persistent Terminal Sessions - Linode Library
# 3  
Old 09-17-2010
Quote:
Originally Posted by Judo_Bear
I am trying to combine these all on one line.
It's going to be difficult to automate su. It insists on interactive authentication, and doesn't run commands listed after it since those are ones your current shell expects to do. It can be told to run things given on the commandline, but then it doesn't prompt you for more commands when it's done!

You could configure sudo instead, to allow you and only you(or perhaps some group of users, etc, etc.) to run a shell under the 'account' user without a password and then, modify account's ~/.profile or ~/.kshrc to run . /home/i5/i5.4/release/account/profile.ksh automatically on login, as well as set the prompt and change directory to where you want. So you go from sudo to doing what you want in one step, or su - account and one password to being setup as you want.

Last edited by Corona688; 09-17-2010 at 06:08 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

A question about Subversion and commit from the command line

Hey guys, so I want to start using the terminal when I do thinks like update, commit and whatnot. I am use to using kdesvn which is a GUI that helps me with subversion. However, kdesvn does not seem to play well on 18.04 and regardless I am trying to move away from GUI's in general. I want to... (1 Reply)
Discussion started by: Circuits
1 Replies

2. UNIX for Beginners Questions & Answers

Question on bash command line

OS : RHEL / Oracle Linux 6.8 In bash shell, how can I replace a character under the cursor with another character ? In the below example , after I typed the following line, I realized that I meant 7013 and not 2013. So I move the cursor to the left and keep it on top of 2 (of 2013) and I want... (7 Replies)
Discussion started by: kraljic
7 Replies

3. UNIX for Beginners Questions & Answers

Basic Linux command line question

:D:D:D These are list of command i typed on opensuse terminal and evolve lots of doubt around ,that i can't answer. COMMAND 1 linux-xavv:/ # cd COMMAND 2 linux-xavv:~ # Does above command 1 and command two with red labelled sign make different meaning or same . 1 linux-xavv:/... (1 Reply)
Discussion started by: lobsang
1 Replies

4. UNIX for Dummies Questions & Answers

UNIX command question

Hi Guys, I am new on the scripting world and would like ask for help if you can. Here are my questions below:- What Unix command(s) would you put in a shell script to read an ASCII comma-delimited input file and validate that field 5 only contains numeric characters? What Unix command(s)... (5 Replies)
Discussion started by: mahiwaga
5 Replies

5. Shell Programming and Scripting

Specify an entire UNIX command as a command line argument

I'm trying to write a bash script called YN that looks like the following YN "Specify a question" "doThis" "doThat" where "doThis" will be executed if the answer is "y", otherwise "doThat". For example YN "Do you want to list the file dog?" "ls -al dog" "" Here's my attempt... (3 Replies)
Discussion started by: LeoKSimon
3 Replies

6. UNIX for Dummies Questions & Answers

New to Unix command line and have a question about the "sort" command

I am going through the Unix Made Easy second edition book by John Muster. So far it's been very informative and I can tell it may be a bit out of date. In one of the exercises it talks about the "sort" command and using it to sort column's of data etc. The "sort" command has changed a bit and... (1 Reply)
Discussion started by: budfoxcat
1 Replies

7. UNIX for Advanced & Expert Users

unix command : how to insert text at the cursor location via command line?

Hi, Well my title isn't very clear I think. So to understand my goal: I have a script "test1" #!/bin/bash xvkbd -text blabla with xbindkeys, I bind F5 key in order it runs my test1 script So when I press F5, test1 runs. I'm under Emacs/Vi and I press F5 in order to have "blabla" be... (0 Replies)
Discussion started by: xib.be
0 Replies

8. Shell Programming and Scripting

assign a command line argument and a unix command to awk variables

Hi , I have a piece of code ...wherein I need to assign the following ... 1) A command line argument to a variable e.g origCount=ARGV 2) A unix command to a variable e.g result=`wc -l testFile.txt` in my awk shell script When I do this : print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies

9. Solaris

shutdown question from command line

solaris 10 logged in as root to command line...want to shut the system down....could not do this....when i chose shutdown the system seemed to squawk at me saying i'd lose whatever i was working on would be lost unless i logged out...after proceeding through this it took me to the gui log in... (6 Replies)
Discussion started by: drisnya
6 Replies

10. UNIX for Dummies Questions & Answers

Unix command question

I recently went in for a job interview and the guy asked me what I knew about Unix. I told him not much since I haven't worked with it in a few years. He then asked me the following question: What Unix or Linux shell command will tell you the names of all files in the current directory, along... (2 Replies)
Discussion started by: BMWBigD
2 Replies
Login or Register to Ask a Question