11-08-2010
If statement in my prompt?
Anyone know how I can do a simple if statement in my prompt? As it is now I run a few commands to customize my prompt using command substitution. What I would prefer is if I could change the color dependent on the results.
So `command` > output > if = 'x' then color=blue else color=red
That way I can make certain problems stand out more and draw my attention to them.
As it is I have a ridiculously complicated prompt that runs numerous commands and generate a 2 line prompt filled with useful nuggets of info.. sometimes I miss something.
10 More Discussions You Might Find Interesting
1. Solaris
Hi,
I'm attempting to reinstall a damaged installation of Solaris 9 (on a SunFire). Connected via serial from a PC. Can't get to the "ok" prompt to launch install from CD. Ctrl+break acknowledges my request for a break, but no prompt. "#." gets me an "sc>" prompt, with several options, but... (3 Replies)
Discussion started by: shonenfan
3 Replies
2. Solaris
Here is a silly question:
I have a Sun 220R and I need to get to the OK prompt. I can't hook up a monitor and keyboard to it. Its on a KVM right now and I also have a console connected to it. I can use PuTTY to get to the console and then connect to the 220R from there.
How can I get to the... (3 Replies)
Discussion started by: hshapiro
3 Replies
3. Shell Programming and Scripting
Hi i am working with clearcase in my UNIX machine...
Accidentally some had ran a script to check out all files in the machine....
Now i am actually trying to uncheck out all those files and had written a script for it....
The problem is that when ever i am trying to uncheck out the files, its... (2 Replies)
Discussion started by: grajesh_955
2 Replies
4. Shell Programming and Scripting
In my ksh script, if the conditions of a if statement are true, then do nothing; otherwise, execute some commands.
How do I write the "do nothing" statement in the following example?
Example:
if (( "$x"="1" && "$y"="a" && "$z"="happy" ))
then
do nothing
else
command
command
fi... (3 Replies)
Discussion started by: april
3 Replies
5. Shell Programming and Scripting
Hi All,
I am using Unix ksh script.
I need to insert values to a table using the o/p from a slelect statement.
Can anybody Help!
My script looks like tihs.
---`sqlplus -s username/password@SID << EOF
set heading off
set feedback off
set pages 0
insert into ${TB_NAME}_D... (2 Replies)
Discussion started by: nkosaraju
2 Replies
6. Solaris
There is a number before the ok prompt in OBP between brackets {}. It is 0 most of the time but sometimes it is different number
{9} ok
or
{0} ok
What does this number mean and how it gets changed? (3 Replies)
Discussion started by: StarSol
3 Replies
7. Solaris
We have a Solaris 10 machine.
Today a weird issue happened.
After login remotely via ssh, the motd appeared BUT
there was no prompt!
The prompt only appears after pressing Ctrl+d or Ctrl+c.
Strange behaviour.
I have checked /etc/profile and own user .profile, there is no anamoly.
... (11 Replies)
Discussion started by: sundar63
11 Replies
8. UNIX for Dummies Questions & Answers
how to Change the % prompt to - prompt in unix
:wall:
---------- Post updated at 07:40 AM ---------- Previous update was at 07:38 AM ----------
How To display the last modification time of any file in unix
---------- Post updated at 07:40 AM ---------- Previous update was at 07:40 AM... (2 Replies)
Discussion started by: manjiri sawant
2 Replies
9. Solaris
Hi,
on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break. (9 Replies)
Discussion started by: manoj.solaris
9 Replies
10. Shell Programming and Scripting
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
LEARN ABOUT CENTOS
backup_interactive
BACKUP_INTERACTIVE(8) AFS Command Reference BACKUP_INTERACTIVE(8)
NAME
backup_interactive - Enters interactive mode
SYNOPSIS
backup [interactive] [-localauth] [-cell <cell name>]
[-help]
backup [i] [-l] [-c <cell name>] [-h]
DESCRIPTION
The backup interactive initiates an interactive session for issuing backup commands. As indicated in the syntax statement, the operation
code (interactive) is optional.
Several features of interactive mode distinguish it from regular mode:
o In interactive mode, the "backup"> prompt replaces the system (shell) prompt. The operator enters only a command's operation code
(omitting the command suite name, backup).
o If the -localauth flag or the -cell argument is included on the backup interactive command, the settings apply to all commands issued
during that interactive session. The issuer does not need to type them on every command. Another consequence is that the flag and
argument do not appear in the syntax statement generated by the help subcommand or -help flag on an individual command issued at the
"backup"> prompt.
o The backup jobs and backup kill commands are available only in interactive mode. It is not possible to track and terminate backup
operations as cleanly in non-interactive mode.
o It is not necessary to enclose strings that include metacharacters in double quotes or other delimiters.
o The backup command interpreter establishes a connection to the Backup Server, Volume Server and Volume Location (VL) Server processes
as it enters interactive mode, and uses the same connection for all commands during the session. Execution time can therefore be faster
than in non-interactive mode, in which the command interpreter must establish a new connection for each command.
To exit an interactive session, issue the backup quit command.
OPTIONS
-localauth
Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The backup command interpreter presents it to
the Backup Server, Volume Server and VL Server during mutual authentication. Do not combine this flag with the -cell argument. For more
details, see backup(8).
-cell <cell name>
Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see backup(8).
-help
Prints the online help for this command. All other valid options are ignored.
EXAMPLES
The following example shows how the -localauth flag and -cell argument do not appear when the help dump subcommand is issued in interactive
mode.
% backup
backup> help dump
dump: start dump
Usage: dump [-volumeset <volume set name>] [-dump <dump level name>]
[-portoffset <TC port offset>] [-at <Date/time to start dump>+]
[-append ] [-n ] [-file <load file>] [-help ]
PRIVILEGE REQUIRED
None. However, backup commands that require privilege in regular mode still require it in interactive mode.
SEE ALSO
backup(8), backup_jobs(8), backup_kill(8), backup_quit(8), butc(8)
COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.
This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas
Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.
OpenAFS 2012-03-26 BACKUP_INTERACTIVE(8)