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
msh(1mh)																  msh(1mh)

Name
       msh - MH shell

Syntax
       msh [ -help ] [ -prompt string ] [ file ]

Description
       The command is an interactive program that implements a subset of the normal MH commands operating on a single file in format.  That is, is
       used to read a file that contains a number of messages, as opposed to the standard MH style of reading a number of files, each file being a
       separate message in a folder.

       The chief advantage of is that, unlike the normal MH style, it allows a file to have more than one message in it.  In addition, can be used
       on other files, such as message archives which have been packed using

       When invoked, reads the named file, and enters a command loop.  You can type most of the normal MH commands.  The syntax and  semantics	of
       these  commands	typed to are identical to their MH counterparts.  In cases where the nature of would be inconsistent with the way MH works
       (for example, specifying a +folder with some commands), will duly inform you.  The commands that currently supports are:
       ali	burst	 comp	 dist	  folder
       forw	inc	 mark	 mhmail   msgchk
       next	packf	 pick	 prev	  refile
       repl	rmm	 scan	 send	  show
       sortm	whatnow  whom

       In addition, has a command which gives a brief overview of all the options.  To terminate either type <CTRL/D>, or use the command.  If the
       file is writable and has been modified, then using will ask you if the file should be updated.

       A redirection facility is supported by Commands may be followed by one of the following standard ULTRIX symbols:

       |	 Open an interprocess channel; connect output to another ULTRIX command.

       >	 Write output to file.

       >>	 Append output to file.

       If file starts with a tilde (~), then a C-shell-like expansion takes place.  Note that commands are interpreted by

       When  parsing  commands	to the left of any redirection symbol, will honor the backslash () as the quote next-character symbol, and double
       quotes (") as quote-word delimiters.  All other input tokens are separated by white space (spaces and tabs).

       You may wish to use an alternative profile for the commands that executes; see for details of the $MH environment variable.

Options
       -help	 Prints a list of the valid options for this command.

       -prompt string
		 Sets the prompt for If the string you specify includes white space, you must enclose it in double quotes  (").   If  you  do  not
		 specify this option, the default prompt is (msh).

       The following defaults are used by

	      file defaults to
	      -prompt (msh)

Restrictions
       The  shell  is  not the C-shell, and a lot of the facilities provided by the latter are not present in the former.  In particular, does not
       support back-quoting, history substitutions, variable substitutions, or alias substitutions.

       does not understand back-quoting.  The only effective way to use inside is to always use the -seq select option.  If you add the  following
       line to your will work equally well from both the shell and
       pick: -seq select -list

       There is a strict limit of messages per file in format which can handle.  Usually, this limit is 1000 messages.

Profile Components
       Path:	      To determine your Mail directory
       Msg-Protect:   To set protections when creating a new file
       fileproc:      Program to file messages
       showproc:      Program to show messages

Files
       The user profile.

       The system customization file.

See Also
       csh(1), packf(1mh), sh(1), mh_profile(5mh)

																	  msh(1mh)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy