Solved

what does this code mean?

Posted on 2014-04-23
5
308 Views
Last Modified: 2014-05-01
I came cross these lines of codes and can't understand them. Anyone here could help me with them?  Thank you.

#PS1="\[\033[1;31m\][\$(date +%H%M)][\u@\h \[\033[01;34m\]\W $ \[\033[00m\]"
#PS2='> '
#PS4='+ '

#if [ $USER = "oracle" ]; then
#  if [ $SHELL = "/bin/ksh" ]; then
#    ulimit -p 16384
#    ulimit -n 65536
#  else
#    ulimit -u 16384 -n 65536
#  fi
#fi
0
Comment
Question by:Jason Yu
5 Comments
 
LVL 5

Accepted Solution

by:
Pasha Kravtsov earned 167 total points
ID: 40018923
PS1 is part of a configuration which you can see by typing 'set' into the console. Specifically whenever you use bash or sh you see usually
[user@hostname directory/you're/at] $ ls

Open in new window

Something of that nature and PS2 and PS4 if I recall correctly do the same thing just different sytles? Here is a great article on it http://www.thegeekstuff.com/2008/09/bash-shell-take-control-of-ps1-ps2-ps3-ps4-and-prompt_command/

looks like if your user is oracle then see if it's using the shell ksh and change ulimit options based on it
http://ss64.com/bash/ulimit.html
^ great man page on it
0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 167 total points
ID: 40022409
Is there a #! line at the top of the file to say what language this is in?
It looks like all the code is commented out, so it seems to mean nothing.
0
 
LVL 19

Assisted Solution

by:simon3270
simon3270 earned 166 total points
ID: 40023153
The PS1 lines set sthe shell prompt to the current time (HHMM), the user name and the host name (all in red), then the current directory (just the directory name, not the full path) in light blue.

PS2 is the prompt used when a continuation line is required (e.g. if you don't close a quoted string on the command line, or you type a "for" or "while" loop into the shell.

PS4 is the string that the shell uses to go in front of lines it will be executing, if "set -x" has been run.

The "if" test at the end only does the work for the "oracle" user.  It sets the maximum size of a pipe between processes (the "-p" option), and the maximum number of open file descriptors (-n).  In the Korn shell, these must be done as separate commands - in other shells they can be done as multiple settings on a single command (though note that the Bash shell says that you can't set -p).
0
 
LVL 5

Expert Comment

by:Pasha Kravtsov
ID: 40023210
@ozo that might be your .bashrc? I'm not sure
0
 

Author Comment

by:Jason Yu
ID: 40035002
yes, it's from a .bashrc file. I will read all the references.

Thank you guys here.
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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

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

18 Experts available now in Live!

Get 1:1 Help Now