I'm new to shell scripting and was reading online how shell scripts could be written.
I made this following script but it doesn't seem to work, but when I type this command directly in the terminal window then it works. Can someone please tell me why this is not working.
Thanks in advance.. Following is my script code
#!/bin/bash
history | grep " ls$" | cut -c 1-5 > /tmp/histDelTemp
But when I type
history | grep " ls$" | cut -c 1-5 > /tmp/histDelTemp
directly in the Terminal then it works correctly and generates the output in the /tmp/histDelTemp file.