I have a simple single line that works fine in the terminal:
history | sort -k2 | uniq -c --skip-fields=1 | sort -r -g | head
What he does: recently released the 10 most frequently used commands. (Do not ask me why I would like to achieve such a goal)
I start the editor and type the same from #!/bin/bashthe beginning:
#!/bin/bash
history | sort -k2 | uniq -c --skip-fields=1 | sort -r -g | head
And I will say that I save it as script.sh. Then, when I go to the same terminal, enter bash script.shand press Enter, nothing will happen.
What I have tried so far: Googling. Many people have similar pains, but they are resolved by using sudo suor adding / removing spaces. None of this worked for me. Any idea where I could be wrong?
Edit:
. , script, .
, BryceAtNetwork23, history, ?