![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| prompt line | sobnc | AIX | 0 | 01-19-2008 05:50 PM |
| command for deleting log files based on some condition | pulkit | Shell Programming and Scripting | 4 | 01-09-2008 06:17 AM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | SuSE | 5 | 07-30-2007 08:26 AM |
| Path in prompt line? | Leitwolf | UNIX for Dummies Questions & Answers | 4 | 04-02-2007 03:25 PM |
| 2 line prompt | Kelam_Magnus | UNIX for Dummies Questions & Answers | 7 | 06-13-2002 10:23 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to enter if-then condition on command prompt/line ?
Hi
I have some trouble entering if-then condition in a single line on a command prompt in csh. Could someone show how does one do that ? eg: source .cshrc; cd $dir; pwd; test -d $backup_dir; if [ $? -eq 1 ] then mkdir -p ${backup_dir}; echo inside loop; fi; echo outside loop; mv -f $data_dir/* $backup_dir; I keep getting error saying error saying [sshexec] if: Expression Syntax. [sshexec] Remote command failed with exit status 1 thank you. |
|
|||||
|
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 % Code:
% if ( ! -d backup ) \ ? mkdir -p backup % |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|