Script to check if files exits

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Script to check if files exits
# 8  
Old 08-19-2017
Another one with a for loop
Code:
cd /root
moved=0
for cfile in core*
do
  if [ -f "$cfile" ]
  then
    mv "$cfile" /tmp/scriptor
    moved=1
  fi
done
if [ $moved -eq 0 ]
then
  echo "No core file"
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script to compare file all the files exits or not

Currently i am building a script like based on region parameter it will filter the records in config file and then it will create a text file like ab.txt and it will read the path location in that file and now i need to compare the files name in the config file to files in the path of the config... (1 Reply)
Discussion started by: saranath
1 Replies

2. Shell Programming and Scripting

Script exits when using UNIX2dos / dos2UNIX

I'm not sure why but my script quits automatically at the point where unix2dos / dos2unix command is used. :confused::confused::confused: How do a fix it? LOG_FILE=MADDY.txt unix2dos ${LOG_FILE} exec 2> $LOG_FILE 1>&2 echo ${LOG_FILE} The script exists after the below... (3 Replies)
Discussion started by: machomaddy
3 Replies

3. Shell Programming and Scripting

Ssh bash script exits without remote command completion

Hi, My goal is to connect from unix server A to windows server B and call a bat file on windows. I am able to succeed in remoting to windows and executing a command, the issue i am facing is the shell scrip is exiting without making sure of bat file success. Can you please help me in... (4 Replies)
Discussion started by: pxp018
4 Replies

4. UNIX for Dummies Questions & Answers

Script dosent exits after executing the script

Hi i wrote a script which dosent exists after executing any help #!/bin/bash netstat -ptlen | grep 10000 if ; then echo "Hive Thrift server is running" exit 0 else echo "Hive Thrift server is down Trying to Bring up the service" | mail -s "ALERT" team@domain.com `nohup hive... (7 Replies)
Discussion started by: vikatakavi
7 Replies

5. Shell Programming and Scripting

Check when user exits SUDO

Hello to everyone, I'm new here and would like to thank everybody for the upcoming support, I know that I will have my question answered here, this community is huge. :) First of all, I´m a DBA and work on a daily basis on Unix environments of all kinds (HP-UX, Solaris, AIX, etc). I have... (8 Replies)
Discussion started by: ZeroBR
8 Replies

6. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

7. Shell Programming and Scripting

'script' command exits immediately

I'm trying to capture the output of some commands with the 'script' utility. Normally, I would type 'script /path/to/output/file', then enter commands, then hit ctrl+D to end the 'script' capture. I'm having trouble with it on a server. Upon starting 'script', it exits immediately before I type... (6 Replies)
Discussion started by: jalburger
6 Replies

8. Shell Programming and Scripting

Exits from putty instead of shell script

Dear, I have written below code to initiate the log at top of my script. #Set the log file LOGFILE=<path>/<filename.log> exec > $LOGFILE 2>&1 ............... .... ... .. ............ echo -e "\n\n Script finished OK " `date "+%m/%d/%y %H:%M:%S" ` "\n\n" exit 0 the logging ends only... (14 Replies)
Discussion started by: Imran_Chennai
14 Replies

9. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

10. Shell Programming and Scripting

Script exits with $? not 0 randomly, how can I see what command failed?

Hi! I have this situation with 3 shellscripts. One is a "startscript" that simply calls other scripts. This one is scheduled with cron to run at regular intervals. That script runs what I'll refer to as Script 1. Script 1 in turn runs script 2 (import_catalogs_buyer.sh) Sometimes, seemingly... (2 Replies)
Discussion started by: trailsmoke
2 Replies
Login or Register to Ask a Question
ECL(1)							      General Commands Manual							    ECL(1)

NAME
ecl - Embeddable Common LISP SYNOPSIS
ecl [-dir dir] [-load file] [-eval expr] [-compile file [-o ofile] [-c [cfile]] [-h [hfile]] [-data [datafile]] [-s] [-q]] DESCRIPTION
ECL stands for Embeddable Common-Lisp. The ECL project is an effort to modernize Giuseppe Attardi's ECL environment to produce an imple- mentation of the Common-Lisp language which complies to the ANSI X3J13 definition of the language. The current ECL implementation features: o A bytecodes compiler and interpreter. o A translator to C. o An interface to foreign functions. o A dynamic loader. o The possibility to build standalone executables. o The Common-Lisp Object System (CLOS). o Conditions and restarts for handling errors. o Sockets as ordinary streams. o The Gnu Multiprecision library for fast bignum operations. o A simple conservative mark & sweep garbage collector. o The Boehm-Weiser garbage collector. ecl without any argument gives you the interactive lisp. OPTIONS
-shell file Executes the given file and exits, without providing a read-eval-print loop. If you want to use lisp as a scripting language, you can write #!${exec_prefix}/bin/ecl -shell on the first line of the file to be executed, and then ECL will be automatically invoked. -norc Do not try to load the file ~/.eclrc at startup. -dir Use dir as system directory. -load file Loads file before entering the read-eval-print loop. -eval expr Evaluates expr before entering the read-eval-print loop. -compile file Translates file to C and invokes the local C compiler to produce a shared library with .fas as extension per default. -o ofile When compiling file name the resulting shared library ofile. -c cfile When compiling name the intermediary C file cfile and do not delete it afterwards. -h hfile When compiling name the intermediary C header hfile and do not delete it afterwards. -data [datafile] Dumps compiler data into datafile or, if not supplied, into a file named after the source file, but with .data as extension. -s Produce a linkable object file. It cannot be loaded with load, but it can be used to build libraries or standalone executable programs. -q Produce less notes when compiling. The options -load, -shell, and -eval may appear any number of times, and they are combined and processed from left to right. AUTHORS
The original version was developed by Giuseppe Attardi starting from the Kyoto Common Lisp implementation by Taiichi Yuasa and Masami Hagiya. The current maintainer of ECL is Juan Jose Garcia Ripoll, who can be reached at the ECL mailing list. FILES
~/.ecl, ~/.eclrc Default initialization files loaded at startup unless the option -norc is provided. (if they exist). SEE ALSO
ANSI Common Lisp standard X3.226-1994 The Common Lisp HyperSpec BUGS
Probably some. Report them! 4th Berkeley Distribution 03/10/03 ECL(1)