How to retrieve the value of variable in shell script which is called by crontab
There are two files one is shell script (sample.sh) and another is configuration file (sampl_conf.cfg)
configuration file contains one variable $FTP_HOME. the value of this variable vaires for user to user. If user is say jadoo then value is /home/jadoo/ftp/, for user1 - /home/user1/ftp. The value can be seen at command prompt by typing "echo $FTP_HOME".
In shell script $FTP_HOME variable is used to find out some old file in that path (/home/jadoo/ftp).
Shell scripts reads the configuration file line by line and assing $FTP_HOME variable to another variable say "path"
Now find should search mentioned file for specific duration in $FTP_HOME directory, but it unable to replace the $FTP_HOME variable by its value.
below error displays on terminal
find: stat() error /log*: No such file or directory
Sample configuration file
thanks in advance.
---------- Post updated at 12:26 PM ---------- Previous update was at 12:02 PM ----------
If it's set system-wide for all users, look in /etc/profile or any scripts invoked by ~/.profile. Depending on the shell you might have to check /etc/*bash*, ~/.bashrc, ~/.login too.
I want to make a config file which contain all the paths.
i want to read the config file line by line and pass as an argument on my below function.
Replace all the path with reading config path line by line and pass in respective functions.
how can i achieve that?
Kindly guide.
... (6 Replies)
Hi all,
Warm regards!
I am in a difficult situation here. I have been trying to create a shell script which calls another shell script inside. Here is a simplified version of the same.
Calling Script.
#!/bin/ksh
# want to run as a different process... (6 Replies)
Hi,
I am calling a Perl script in my shell script. When Perl script is executed it asks for a answer to be entered by user from terminal. How can i pass that value from my shell script ??
I know I can change perl script to default the answer but i dont have access to do that so only option i... (5 Replies)
Hi,
I'm writing a Bash script for wallpaper clocks which works fine on the command line but needs to be run every minute from a crontab entry so the time gets changed on the wallpaper (the wallpaper gets rebuilt every minute so the current weekday, date, month, hour, and minute become part of... (4 Replies)
Hi All,
I have a file which sets all the variables on unix , based on the hostname. Currently these variables are hardcoded in the cobol programs.I was wondering if unix variables can be used in Cobol programs ?
Example :
I have a variable $SHTEMP which is set based on the following :
Prod... (2 Replies)
Please help me on below..
https://www.unix.com/shell-programming-scripting/141533-retrieve-value-environment-variable-shell-script-called-crontab.html#post302442024
I'm still here. I can still see you! (0 Replies)
There are two files one is shell script (sample.sh) and another is configuration file (sampl_conf.cfg)
configuration file contains one variable $FTP_HOME. the value of this variable vaires for user to user. If user is say jadoo then value is /home/jadoo/ftp/, for user1 - /home/user1/ftp. The... (0 Replies)
Hi,
I have a generic FTP script which will be called by 28 different processes in parallel (through a GUI tool) may or may not be at the exact moment (there could be a delay of about a minute or so).
./FTP.ksh 1 (1 through 28)
This script after importing file from remote m/c... (1 Reply)
Hi all,
I have two ksh scripts
#sample1.sh
#!/bin/ksh
. ./sample2.sh
echo $fileExist
#sample2.sh
#!/bin/ksh
func()
{
i=1
return $a
}
func
echo $?
Here how should I return the value of sample2.sh back to sample1.sh?
Thanks in advance. (2 Replies)
I'm puzzled by this one. I hope you can explain it to me.
I have a ksh shell script that gzips a file among other things. This works perfectly fine when the script is manually run through a shell. However, when the same script is run through cron, it does everything correctly, but it will... (2 Replies)