Solved

what does this code mean?

Posted on 2014-04-23
5
304 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

707 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

13 Experts available now in Live!

Get 1:1 Help Now