I am calling a system call from my linux application.
/* Some file.c */ file.c is embedded in an executable called file.elf. this file.elf is present in directory /home/ubuntu/file.elf when i execute the file.elf the echo $BB_PATH prints the executable directory path. i am expecting the directory path to be the path where the script has been placed. i.e /home/ubuntu/Desktop/BIN/BB/Chk_File.sh
How can this be acheived ?
if(!(system("ls /home/ubuntu/Desktop/BIN/BB")))
    {
    /* Test Path : remove after testing */
    dw_flag = system("/home/ubuntu/Desktop/BIN/BB/Chk_File.sh");//Call to execute Script
    dw_flag = WEXITSTATUS(dw_flag); 
    }
this in turns call the file CHK_File.sh
ret_val=0
BB_PATH=$(pwd)
echo $BB_PATH
if [ ! -f ACTION_TAG.txt ]
then
  echo " ACTION_TAG NOT PRESENT "
else
ret_val=1       
fi
echo $ret_val
exit $ret_val
 
     
    