Solved

what does this code mean?

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

820 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