KornShell Forwarding (ksh)

I have a script that redirects std out / std err, as shown below:

SCRIPTS=/test/scripts
LOG=/test/log
echo $SCRIPTS
echo $LOG
$SCRIPTS/dmm_algo_ofac_daily_sched.ksh >> $LOG/test12.log 2>&1

This script cannot extend $SCRIPTSand$LOG

If I replaced it as shown below:

/test/scripts/daily_sched.ksh >> /test/log/test12.log 2>&1

He complains as shown below:

: bad file unit numberd/test.ksh: line 33: 1

Also, I cannot call the script from the directory in which it was saved. If i do

./test.kshthis gives me an error if the file is not found. I can execute it through ksh /test/sched/test.kshthough.

Can someone help me with this. Thanks in advance.

+3
source share
3 answers

I am pretty sure the problem is with DOS / Windows line termination

, , - . , dos2unix.

+4

#!/bin/ksh , , .

+1

I will guess that your main reason (a) has nothing to do with redirection.

Are you showing script / test / sched / test.ksh or /test/scripts/test.ksh? Are you sure?

0
source

Source: https://habr.com/ru/post/1782485/


All Articles