Sponsored Content
Top Forums Shell Programming and Scripting Unwanted Error Message on Screen Post 88089 by ilak1008 on Monday 31st of October 2005 02:52:56 PM
Old 10-31-2005
Unwanted Error Message on Screen

Below is a part of the script that I wrote when checking whether a file exist in the Internal Disk or not. If a file doesn't exist, how do you get rid of the error message "file or directory does not exist" to show up on screen? Instead, I wanted only the warning message "FILE DOES NOT EXIST IN INTERNAL DISK" that I have setup to appear? Please help me out. Thanks a lot!

#! /bin/csh -f
# fn = filename.
set fn = `cat fn`
#cfn = check filename if it exist in Internal disk.
set cfn = y
while ($cfn == y)
printf "\n\n\n\nEnter filename, `echo $fn` (default) or x (exit): "
set fn = $<

if ($fn == x) then
else
if ( $fn == "" ) then
set fn = `cat fn`
else
echo $fn > fn
endif

ls $SOLHOME/internalDisk/"$fn" | wc -l > cfn
clear

set cfn = `cat cfn`
if ( $cfn == 0 ) then
printf "\n\n\n\n%8s==================================================\n\n"
printf " "\""FILE "\"""$fn""\"" DOES NOT EXIST IN THE INTERNAL DISK\!"\"""
printf "\n\n%8s==================================================\n"
set cfn = y
#end1
end
else
endif
endif
 

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Display message on screen and flat file at same time

Hi guys, I have a script that call another, the other displays de message and I can print directly to the flat file, but in one command I am searchig that this message can be displayed in the screen and in the flat file in one command. I am doing something like this: var=$(./Example.sh)... (2 Replies)
Discussion started by: pipoca
2 Replies

2. AIX

AIX power problem cron message on screen

Hello, I keep getting this message even after i removed it from the cron enteries it was added automatically Broadcast message from root@oradb (tty) at 12:00:00 ... rc.powerfail:2::WARNING!!! The system is now operating with a power problem. This message will be walled every 12... (2 Replies)
Discussion started by: filosophizer
2 Replies

3. Red Hat

command line tool to disable screen lock and/or screen saver

Hi, I have a simple question : how to disable screen lock and/or sreen saver with command line with RHEL5.4 ? (1 Reply)
Discussion started by: albator1932
1 Replies

4. Shell Programming and Scripting

Getting phone number, its message and assigning them into 2 variables then screen output.

Hi Everyone, I have a flatfile "inbox.txt" which contains some information: Location 0, folder "Inbox", SIM memory, Inbox folder SMS message SMSC number : "+24800000023" Sent : Sat 04 Aug 2012 09:01:00 PM +0700 Coding : Default GSM alphabet... (5 Replies)
Discussion started by: testcase
5 Replies

5. UNIX for Dummies Questions & Answers

Accidentally made a screen within a screen - how to move it up one level?

I made a screen within a screen. Is there a way to move the inner screen up one level so that it is at the same level as the first screen running from the shell? (2 Replies)
Discussion started by: phpchick
2 Replies
All times are GMT -4. The time now is 10:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy