Sponsored Content
Top Forums Shell Programming and Scripting Shell script to check files if exist else touch the file Post 302694279 by delugeag on Thursday 30th of August 2012 10:33:43 AM
Old 08-30-2012
what is your output ?

Code:
for i in "subscriber promplan mapping dedicatedaccount faflistSub faflistAcc accumulator pam_account"

I think you will have only one loop with i="subscriber promplan mapping dedicatedaccount faflistSub faflistAcc accumulator pam_account"

so the script do a

Code:
touch 
SDP_DUMP_subscriber promplan mapping dedicatedaccount faflistSub faflistAcc accumulator pam_account.csv

Try with this for:
Code:
for i in subscriber promplan mapping dedicatedaccount faflistSub faflistAcc accumulator pam_account

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Have a shell script check for a file to exist before processing another file

I have a shell script that runs all the time looking for a certain type of file and then it processes the file through a series of other scripts. The script is watching a directory that has files uploaded to it via SFTP. It already checks the size of the file to make sure that it is not still... (3 Replies)
Discussion started by: heprox
3 Replies

2. Shell Programming and Scripting

How to check a file exist and do a copy of other files

Hi, I would like to perform bash which would check the file A.txt to be size 0 or not. If the size is 0, I would copy file B.txt to replace A.txt. Please help. Thanks. -Jason (6 Replies)
Discussion started by: ahjiefreak
6 Replies

3. UNIX for Dummies Questions & Answers

Need Script to check file exist and compare

I need a script that will check for the existence of new files that FTP'd in the morning, results go to log file. The 2nd step is to compare the new file with the previous days file. If the new file size is 30% or more smaller in size then previous day this needs to also be sent to log. This... (1 Reply)
Discussion started by: rbknisely
1 Replies

4. UNIX for Dummies Questions & Answers

How to check path exist or not in UNIX shell script

UNIX Shell Script I'm in /home/suneel dirctory in that directory need to check for a path for example com/src/resources If Path exists need to copy the files from one directory If path not exist need to create the folders and copy the files UNIX shell script help required (3 Replies)
Discussion started by: suneelc
3 Replies

5. Shell Programming and Scripting

Check file and if it doesnt exist , exit script

Hi, Another problem, here is my code #!/bin/sh dir='/opt/apps/script/CSV' datadir='/opt/apps/script/data' while : ; do ls -1rt $dir/*.csv > /dev/null 2>&1 if ;then cp $datadir/weekly.txt $dir/weekly.csv else exit 0 fi done (10 Replies)
Discussion started by: tententen
10 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

Verifying if a file exist (script shell)

Hello, This is my code: nb_lignes=`wc -l $1 | cut -d " " -f1` for i in $(seq $(($nb_lignes - 1)) ) do machine=`head $1 -n $i | tail -1` machine1=`head $1 -n $nb_lignes | tail -1` ssh root@$machine -x " scp /home/file.txt root@$machine1:/home && rm -r /home/file.txt" done fi ... (2 Replies)
Discussion started by: chercheur857
2 Replies

8. Shell Programming and Scripting

Check for a file and touch if not exist

Hi, I've a situation where i need to check for the file existence and create a zero byte file based on the parameter,in some cases i need to touch and in some case i dont need to touch with zero byte file please help me on parameterizing this touch command?? Regards. San (2 Replies)
Discussion started by: sandeep karna
2 Replies

9. Red Hat

Shell Script to touch a file

our requirement is that we need to create a touch file on 2 4 and 7 th working day of the each month ... If the days falls on saturday/sunday, the touch file should be created on next working day. We are currently on Red hat 6.5 (1 Reply)
Discussion started by: tradingspecial
1 Replies

10. Shell Programming and Scripting

Shell script to check a file and delete old files

Hello, I needed help with a shell script where in it checks if a file exists under a directory and also checks the age of the file and delete it if it is older than 3 weeks. thanks (10 Replies)
Discussion started by: hasn318
10 Replies
SHTOOL.TMP(1)						      GNU Portable Shell Tool						     SHTOOL.TMP(1)

NAME
shtool - The GNU Portable Shell Tool VERSION
GNU shtool 2.0.8 (18-Jul-2008) SYNOPSIS
shtool [ global_options ] command [ command_options ] [ command_args ] DESCRIPTION
GNU shtool is a compilation of small but very stable and portable shell scripts into a single shell tool. All ingredients were in successful use over many years in various free software projects. The compiled shtool script is intended to be used inside the source tree of those free software packages. There it can take over various (usually non-portable) tasks related to the building and installation of such packages. GLOBAL OPTIONS
The following global options are available for shtool. Any commands are ignored if one of them is present on the shtool command line. -h, --help Displays a short help page describing the usage of shtool and it's ingredient commands in a compact way. -v, --version Displays the version number of shtool. -d, --debug Displays shell trace messages for debugging purposes. -r, --recreate Recreate the shtool script with its own individual shtoolize(1) call. COMMANDS
The following commands are provided by shtool. They are all called via ""shtool" command". Any command options command_opts and arguments command_args are specific to the particular command and are described in the corresponding manual page shtool_command(1). The commands are listed here sorted by topic, i.e., related commands are listed side-by-side. echo echo(1) style print command providing special expansion constructs (terminal bold mode, environment details, date) and newline control. mdate Pretty-printing of the last modification time of a file or directory. table Pretty-printing a field-separated list as a two-dimensional table. prop Displaying of a processing indication though a running terminal character propeller. move mv(1) style command for renaming/moving multiple files at once and allowing source files just to be deleted if contents did not change. install install(1) style command for installing a program, script or data file in a portable way. mkdir mkdir(1) style command providing support for automatical parent directory creation, directory permission control and smart skipping if directory already exists. mkln ln(1) style command providing automatic calculation and usage of relative links if possible. mkshadow Creation of a shadow filesystem tree by the help of symbolic links. fixperm Fixing of file permissions in a source tree by cleaning up the permission bits. rotate Rotate a logfile. tarball Roll standardized distribution tarballs. subst Apply sed(1) substitution operations. platform Determines platform identification information. arx Extended archive command which can even put existing archives into an archive. slo Separate linker options by library class. scpp An additional C source file pre-processor for sharing cpp(1) code, internal variables and internal functions. version Maintain a version information file in either Text, C/C++, Perl or Python. format. path Deal with shell path variables. SEE ALSO
shtoolize(1), shtool-arx(1), shtool-echo(1), shtool-fixperm(1), shtool-install(1), shtool-mdate(1), shtool-mkdir(1), shtool-mkln(1), shtool-mkshadow(1), shtool-move(1), shtool-path(1), shtool-platform(1), shtool-prop(1), shtool-rotate(1), shtool-scpp(1), shtool-slo(1), shtool-subst(1), shtool-table(1), shtool-tarball(1), shtool-version(1). HISTORY
Some scripts contained in GNU shtool were already written in 1994 by Ralf S. Engelschall for use inside some private source trees. Then they evolved into more elaborated versions over the years and were used in various free software projects like ePerl, WML, iSelect, gFONT, etc. They were complemented with other scripts from the author which he wrote in March 1998 for the ``Apache Autoconf-style Interface'' (APACI) for Apache 1.3. In April 1999 the shtool package was created out of the accumulated master versions of the scripts and in June 1999 it entered the status of an official GNU program and this way finally joined the group of GNU autoconf, GNU automake and GNU libtool. AUTHOR
Ralf S. Engelschall rse@engelschall.com www.engelschall.com 18-Jul-2008 shtool 2.0.8 SHTOOL.TMP(1)
All times are GMT -4. The time now is 03:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy