Hi Experts

I've less idea abt unix shell script. my requirement is the shell script should take a input of a file name and shud check if that file name is present in the particular folder which is hardcoded. if not then wrtie the file there or if found write the fle in another location. is it possible to acheive this. ur help is highly appricicateed. pls copy fo mailprabhu@gmail.com for any good doc's on the same.

Read this.
This is what I'll tell you..

#!/bin/sh

hardcoded_folder="xxx"

#expected args:
# $1: Relative path of file to be checked. (relative to hardcoded path)
# $2: Abs path of "another location"
#
function my_function()
{
    f_2_check=$1
    another_location=$2

    #if -f $hardcoded_folder/$f_2_check then
    #file found, so write to another location
    #copy $hardcoded_folder/$f_2_check another_location/$f_2_check
    #else
    #file not found, so create it
    #touch $hardcoded_folder/$f_2_check
}

my_function file_2_check /another_location
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.