I want to run my code with
nohup shellskriptname &. But whenever I try to see the nohup, it says there is no such file. What can I do, so I can enter it like that?
#!/usr/bin/bash
# To Display Files and Folders from current Directory
echo Displaying all the Directories in the current directory
for item in *
do
if [ -d $item ]
then
echo $item
fi
done
echo Displaying all the Files in the current directory
for item in *
do
if [ -f $item ]
then
echo $item
fi
done
chmod +x display_files.sh? Your script requires execute permissions. – Bib Aug 15 '22 at 17:37nohupcommand you type where invoking the script fails? And also include the error message that you get from the failing command. – Sotto Voce Aug 15 '22 at 17:43nohup display_files.sh &– Eronsee Aug 15 '22 at 17:45ksh. – Chris Davies Aug 15 '22 at 17:46if [ -d $item ]you should writeif [ -d "$item" ], etc. – Chris Davies Aug 15 '22 at 17:47echo $itemis not robust - consider a file called-n, for example. Instead, useprintf '%s\n' "$item"– Chris Davies Aug 15 '22 at 17:48To Display Files and Folders from current Directory
echo Displaying all the Directories in the current directory
for item in * do if [ -d "$item" ] then
done
echo Displaying all the Files in the current directory
for item in * do
done
– Eronsee Aug 15 '22 at 17:53nohup display_files.sh, it'snohup ./display_files.shI think you are missing./. – Bib Aug 15 '22 at 18:34