directory - How to pass a path as argument to shell script and copy a file from the path -
directory - How to pass a path as argument to shell script and copy a file from the path -
i've written bash script open file passed argument , write file. script work if file in current directory. need open , write file not in current directory also.
if compile name of script, ./compile next/123/file.txt should open file.txt in passed path. how can it?
#!/bin/sh #first script clear echo "-----starting compilation-----" #echo $1 name=$1 # re-create filename name find . -iname $name -maxdepth 1 -exec cp {} $name \; new_file="tempwithfile.adb" cp $name $new_file #copy file new_file echo "compiling" dir >filelist.txt gcc writefile.c run_file="run_file.txt" echo $name > $run_file ./a.out echo "" echo "cleaning" echo "" create clean create -f makefile ./semantizer -da <withfile.adb
thankyou
shell directory arguments filenames any
Comments
Post a Comment