I need to change the directory inside the shellscript.i have tried below
#!/bin/bash
sudo -u rv bash
cd /opt/test
source /opt/rv/van.env
./rv.sh |grep "STATUS"
When I tried it didn't cd to that path and not executed th rv.sh.guide me with some ideas.
Fyi rv.sh path /opt/test/
set -x
as the 2nd line in the script and rerun for debug output. and paste your code in ShellCheck to solve 99% of the issues. Why not just run/opt/test/rv.sh | grep "STATUS"
and avoid the directory change?rv
have execute permission in/opt/test
for filerv.sh
?set -x
as the 2nd line of the script?