Run shell script based on date file

Hi Team,

I have a to run a script based on a date present in a different file which updates everyday. Kindly help with the solution.
My current execution :

ksh scriptname.sh 10152019

. But here i want to enter this date from a file which gets updated daily.
My appraoch :
date file location: /var/tmp/datefile.txt

ksh scriptname.sh |cat /var/tmp/datefile.txt 

Does this command work ? or any other suggestions pls.

Thanks,
Midhun

ksh scriptname $(cat filename)
1 Like

if i want to run the script based on date from filename ? pls suggest.
dir: /var/tmp/filename10152019.txt
i want to execute

ksh script.sh <date from filename[date].txt>

Run like:

ksh script.sh /path/to/filename12345.txt

Inside:

#!/bin/ksh

# $1 = filename12345.txt
set -- $(echo "$1" | tr -cd '0-9')
# $1 is now 12345

# rest of program
1 Like