Problem facing command using shell

Dear Brothers!

Need your help for the case where I am running one command on prompt and its giving us the correct output, but when i use the same command from shell its directs no output.:wall:

the command on command prompt is

ls -ltrh * | nawk '{if ($5~ '/$'M'/') print $9}' | grep -v "Aug 21" | grep "nohup" 

and if I use the same command in shell is directs no output

ls -ltrh * | nawk '{if ($5~ '/$'M'/') print $9}' | grep -v "'$date'" | grep "nohup" > output.txt

Please help :confused:

---------- Post updated at 05:01 AM ---------- Previous update was at 03:22 AM ----------

hello anyone can help in this regards

Check to be sure $date is the same as 'Aug 21'...it may not be, especially if there's a format applied.

Otherwise, please be more clear on your distinction between command-line and shell...do you mean interactive shell and script, or perhaps cron, which uses an altogether separate shell instance?