Sponsored Content
Top Forums Shell Programming and Scripting How to enter if-then condition on command prompt/line ? Post 302166000 by fpmurphy on Sunday 10th of February 2008 11:27:52 AM
Old 02-10-2008
If you are entering a "simple command" with if, you do not need to enter endif as the following example shows:

Code:
% if ( ! -d $backup_dir ) mkdir -p $backup_dir
%

or you can use \ to continue onto the next line as the following example shows:
Code:
% if ( ! -d backup ) \
? mkdir -p backup
%

 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Website-Command Line Prompt

Hello guys... I am having a doubt. Please try to rectify it. I would really appreciate it. The thing is that is it possible to open any website say for example,google from the command line prompt(terminal) if you are working in Linux-fedora... I am very new to Unix. regards, Mahesh... (2 Replies)
Discussion started by: mraghunandanan
2 Replies

2. Shell Programming and Scripting

enter password at prompt during a script?

I'm using rsync with the "-e ssh" option so of course it asks for a password using a prompt. Is there a way to tell a script to expect a prompt, wait for it, and give a password when it arrives? There is a way to give rsync a password as part of its options using a file, but it only works with... (2 Replies)
Discussion started by: davidstvz
2 Replies

3. Shell Programming and Scripting

How to enter commands to the command prompt in a program

Hey, So I'm trying to write a program in unix to automate a process for my astrophysics research. Basically I want the program to prompt the user for some information and store the entered string of text as a variable. I know how to do this. This is where I need help: Now lets say I have a... (4 Replies)
Discussion started by: freemoniez
4 Replies

4. Solaris

Console - root command prompt displayed twice after hitting enter

Dear All, I hope you can help me. I have a pair of E2900's I've inherited. Both running Solaris 9. Both have LOM> consoles. The problem I'm experiencing only occurs when connected to the /dev/console tty. Whenever I hit 'Enter' for a new line, I receive two new lines: - myhost# ... (11 Replies)
Discussion started by: aleith
11 Replies

5. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

6. Shell Programming and Scripting

how to prompt the user to enter an array in tcsh

Hello, I am writing a script that requires the user to enter a string of numbers: ex: 134 345 865 903 This command only allows for one variable to be entered: set "var" = $< and than once I got the array I want to change it to a list with each input on a different line: ... (1 Reply)
Discussion started by: smarones
1 Replies

7. Shell Programming and Scripting

Is it possible to prompt for input if not given on command line?

I have a script built that takes the standard inputs $1 $2 $3 after the name and parses some data. hexsite=`echo "obase=16;$1"|bc` hexfix=$(printf "%.3X" 0x$hexsite) if || ;then type=33 elif || ;then type=59 elif ;then type=99 else type=00 fi cat /directory/*.2012$3*| I am... (8 Replies)
Discussion started by: PCGameGuy
8 Replies

8. Shell Programming and Scripting

Script to prompt user to enter data

Hi All I have a script that moves files from one dir to another dir based on date, but I would like to change it in a way that whoever is going to run to enter the dates in which files will be removed. This is my script: #!/bin/sh touch -mt 201302250000 /tmp/ref3 touch -mt 201302282359... (14 Replies)
Discussion started by: fretagi
14 Replies

9. Shell Programming and Scripting

Auto enter for prompt messages

Hello everybody, I am coding a script, that allow the user to enter some information using prompt messages, i.e: sEpisode=1 read -e -i "$sEpisode" -p "Start download from episode: " downloadFrom sEpisode="${downloadFrom:-$sEpisode}" This code allows the user to set the download from... (4 Replies)
Discussion started by: Abu Rayane
4 Replies

10. Shell Programming and Scripting

Automatically enter input in command line

Hi, This is a script which to create an opvn user, I want which answer automatically to a certain part so, I try this, it works without the red part but I must type manually.. : #!/bin/bash ## Environnement ## LC_ALL=C ## Paths ## rsa_dir="etc/openvpn/easy-rsa"... (10 Replies)
Discussion started by: Arnaudh78
10 Replies
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)
All times are GMT -4. The time now is 04:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy