Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 573
  • Last Modified:

creating a batch file.

How do I creat a linux batch file and / or script that at at login time would set up my sessions environment so that the following "new" commands could be used for the standard linux operting systems commands.
Upon login system prompt is changed to YOURLASTNAME>
Linux commands are expanded to include your customized commands
display contents ofa directory =>mycd
display date and time=>mydt
logoff=>myexit
 
0
joshuaamzat
Asked:
joshuaamzat
1 Solution
 
slyongCommented:
Hi,

> Upon login system prompt is changed to YOURLASTNAME>
in your .bash_profile:
LNAME=yourlastname
PS1='${yourlastname}>'

> display contents ofa directory =>mycd
in your .bash_profile:
alias mycd='ls $1'

> display date and time=>mydt
in your .bash_profile:
alias mydt='date'

The last one might be a bit tricky.. are you using XWindows? or just console?
> logoff=>myexit
in your .bash_profile:
alias myexit='exit'
0
 
joshuaamzatAuthor Commented:
I guess I have no clue about this program. So please help me out. What screen should I be on to eneable me see the login and type these information in?
How do I create the .bash_profile?
Do I include > like you have on here or not?
Thanks for your help in advance
0
 
slyongCommented:
Since you are asking in Linux Programing area, I am assuming that you are using Linux?  Do you know which distribution are you using?  Are you using X-Windows or just console?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
joshuaamzatAuthor Commented:
I have not done this before. But I was asked to create a file using pico text editor. I did do that but then the second part is what i have a problem with. I usually go thru the following steps in my windows XP to get into the system I am using:
start
run
type cmd
at prompt type telnet gator.uhd.edu
after that I type in all the scripts and create my directories
then at the prompt I type pico
this then takes me to a blank screen

So I don't know if that is a hard way to do it.
I need a straight forward instruction that is something better than what I am doing now with this pico thing.
0
 
slyongCommented:
Is this a home assignment problem by any chance?
0
 
joshuaamzatAuthor Commented:
Nope
0
 
slyongCommented:
ok since you have only telnet access you can only use pico, or vi.  pico is much much simpler then vi, so stick with pico.  Do as usual telnet into gator.uhd.edu.  After that, could you do a ls -l ~/ and see if there is a .bash_profile or .bashrc or .profile in there?
0
 
joshuaamzatAuthor Commented:
No sir there is no .bash_profile or .bashrc or .profile in my list of directories.
0
 
joshuaamzatAuthor Commented:
how do I go about creating one?
0
 
slyongCommented:
you can use pico:

$ pico .profile

However, since I am not sure which Unix system you are using and which shell you are using, I am not sure if those things that I do will work.  You have to know what shell you are dealing with.
0
 
joshuaamzatAuthor Commented:
hi, thanks for the effort so far but how do i know what shell iam working with?
0
 
KurtVonCommented:
echo $SHELL

and use

uname -a

to get a list of the kernel type and version, which can also be useful.  And, for the record, .bashrc is only going to show up if you use the command

ls -al

Hope this helps.
0
 
ahoffmannCommented:
# anthing below without a leading # is a command to type in when you logged in via telnet

cd ~
pico .bachrc
# now you're in pico, add all following lines down to but excluding #EOpico, then save the file and exit pico
LNAME=`awk -F: '/^'$USER'/{print $5}' /etc/passwd | awk '{print $2}'`
PS1='${yourlastname}>'
alias mycd='ls -la'
alias mydt='date'
alias myexit='exit'
#EOpico

# logout and log in again, then your commands should be available
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now