I'm using following script on linux server. And which is giving:
: not found [No such file or directory]
This is the script:
# ------------------------------------------------------------------
# K.Sugunan Host health check
# Description
#
# This script to initiate health check on servers.
# It will check for CPU, memory and some connectivity with
# up stream and down stream system.
#
# ------------------------------------------------------------------
# Applying initial variables and loading config parameters
DOCROOT=$(pwd)"/"
TIME_NOW=$(date +"%Y-%m-%d %H:%M:%S")
echo $DOCROOT
. $DOCROOT"config/main.sh"
. $DOCROOT"config/web.sh"
. $DOCROOT"config/telnet.sh"
echo $CPU_A
The error will be like follows:
: not found [No such file or directory]
: not found [No such file or directory]
/home/sugunan/phobos/
: not found [No such file or directory]
: cannot open [No such file or directory]os/
I use following ways to run the script
ksh poc.sh
sh poc.sh
./poc.sh
All of the above giving similar error. Even I include #!/bin/bash
still the error exist. I have tried #!/bin/ksh
and #!/usr/bin/ksh
also. All of that gives the error. What may be the reason for the issue on this server?
set -x
(and better add back the#!/bin/sh
at the real beginning). This little command (I think it works also for ksh, for sure with bash) will display what it will execute and then display the execution output (if any). It is really handy to spot any mistakes. You might have to add it to your other scripts if the error comes from one of them.#!/bin/bash
as first line and start script this way:./poc.sh