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
PREFIX(1)                                                     General Commands Manual                                                    PREFIX(1)

NAME
prefix - Script that allows you to reconfigure environment variables for multiple installations of a set of software installed on the same machine SYNOPSIS
prefix DESCRIPTION
It is assumed that the software for each installation is all under a single directory whose name is assigned to an environment variable called PREFIX. This arrangement of enabling multiple installations of software on a single machine is useful at many times. On a single server, it can provide for development, test, and production installations of software. Alternatively, on development servers, it allows for multiple development "sandboxes", one for each developer. On production servers, it allows for multiple versions of the production software to be installed. One might be the currently running software, one the previous software kept online as a fall-back, and one a new release of software wich is scheduled to be brought online soon. There are three usages of the prefix script: (1) The interactive usage should be placed as the last line of a user's ".profile". The user must be running the Korn shell (ksh) or the Bourne Again shell (bash). The user is prompted to enter one of the known PREFIX locations, specified in the $HOME/.prefixes file or the /etc/prefixes file. During configuration, the $PREFIX/.prefixrc file is sourced in order to accomplish environment-specific configurations. (2) The non-interactive user configuration does not consult $HOME/.prefixes or /etc/prefixes or prompt the user, but merely configures the environment in accordance with the cmd line argument. (3) The batch command usage is mainly for running commands from cron or running commands in another environment without changing to that environment. Usage (1): . prefix (sets up environment) (2): . prefix <prefix> (non-interactive setup) (3): prefix <prefix> <cmd> <args> (runs cmd configured for PREFIX) This manual page was written for the Debian distribution because the original program does not have a manual page. AUTHOR
Prefix was written by Stephen Adkins <spadkins@gmail.com>, and is part of the App-Options distribution. This manual page was written by Jotam Jr. Trejo <jotamjr@debian.org.sv>, for the Debian systems (but may be used by others). Oct 07, 2010 PREFIX(1)
All times are GMT -4. The time now is 12:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy