Solved

what does this code mean?

Posted on 2014-04-23
5
324 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Utilizing an array to gracefully append to a list of EmailAddresses
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 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