Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to run shell script in silent mode Post 91646 by grahamb on Sunday 4th of December 2005 12:11:51 PM
Old 12-04-2005
Running sliently - not interactively

Hi!

Try this idea;

If a script needs to test whether it is running in an interactive shell, it is simply a matter of finding whether the prompt variable, $PS1 is set. (If the user is being prompted for input, then the script needs to display a prompt.)
Code:
if [ -z $PS1 ] # what no prompt?
then
  # non-interactive;   ...
else
  # interactive;   ...
fi

There are other ideas there in this link: http://www.tldp.org/LDP/abs/html/intandnonint.html

One more is that if in background/foreground there is a tty-variable that is set or not set. You could also do something like put a special variable in "~./.profile" that shows that the user is online, eg: $PS1 above. (Just ideas: got no references or clearer ideas on these last ones!)

Hope that was helpful
GrahamB
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Run a shell script from Perl script in Parent shell?

Hi Perl/UNIX experts, I have a problem in running a shell script from my perl script (auto.pl). I run the perl script using perl auto.pl from the shell prompt The shell script picks the files in "input" folder and procesess it. The shell script blue.sh has this code. export... (16 Replies)
Discussion started by: hifake
16 Replies

2. Linux

Wine in silent mode

I want to run through wine the utorrent and I don't want the messages that are usually displayed in the console, so I use the following command wine utorrent.exe > /dev/null & but it doesn't seem to work. Especially the redirection of the messages to the /dev/null doesn't work at all. Do... (1 Reply)
Discussion started by: myle
1 Replies

3. Shell Programming and Scripting

Help need to make a shell script run for ffmpeg vhook watermaking in shell

i have a small problem getting a batxh shell script to run in shell this is the code the problem seems to be centered around the ffmpeg command, something maybe to do with the ' ' wrapping around the vhook part command this is a strange problem , if i take the ffmpeg command and... (1 Reply)
Discussion started by: wingchun22
1 Replies

4. Shell Programming and Scripting

How to run cmds after changing to a new env (shell) in a shell script

Hi, I am using HP-UNIX. I have a requirement as below I have to change env twice like: cadenv <env> cadenv <env> ccm start -d /dbpath ccm tar -xvf *.tar ccm rcv .... mv *.tar BACKUP but after I do the first cadenv <env> , I am unable to execute any of the later commands . ... (6 Replies)
Discussion started by: charlei
6 Replies

5. Shell Programming and Scripting

Script is not exiting from run mode.

Hi Folks. My script is not exiting after run though its working correctly please suggest. #!/bin/ksh trap '' HUP . /bin/functions config_env PATH=/bin:/usr/bin:/usr/local/bin:$EXEC_PATH:$ORACLE_HOME/bin MONTH=$(control_register month) YEAR=$(control_register year) DATE_NOW="Job... (1 Reply)
Discussion started by: Haque123
1 Replies

6. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

7. Red Hat

identifying SU mode by shell script

the following bash script is not working in fedora-11 Could anyone help me please? #!/bin/bash if -ne 0];then echo " you are in root" else echo " you must be in root -su mode??" fi exit (2 Replies)
Discussion started by: Turtel
2 Replies

8. Shell Programming and Scripting

Run a script in silent mode

Hi All, I have a script which calls some other scripts.. When i run the parent script all the status messages are displaying on terminal. I want to know how to suppress dem... or run a script in silent mode Thanks, Firestar (4 Replies)
Discussion started by: firestar
4 Replies

9. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies
BACKUP_QUIT(8)						       AFS Command Reference						    BACKUP_QUIT(8)

NAME
       backup_quit - Leaves interactive mode

SYNOPSIS
       quit [-help]

       q [-h]

DESCRIPTION
       The backup quit command exits interactive mode, returning the issuer to the regular shell prompt at which the backup or backup interactive
       command was issued to enter interactive mode. The command has no effect when issued outside interactive mode. Issuing the Ctrl-D command
       also exits interactive mode.

CAUTIONS
       To exit interactive mode, all jobs must be completed. Use the backup jobs command to list any jobs currently pending or executing, and the
       backup kill command to terminate them as necessary.

OPTIONS
       -help
	   Prints the online help for this command. All other valid options are ignored.

EXAMPLES
       The following command exits interactive mode:

	  backup> quit
	  %

PRIVILEGE REQUIRED
       None

SEE ALSO
       backup(8), backup_interactive(8), backup_jobs(8), backup_kill(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_QUIT(8)
All times are GMT -4. The time now is 01:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy