1
-using Mac OSX 10.14.3,
I have some script files such as this:
#!/opt/local/bin/bash
...do some commands in bash;
I use them a lot from the terminal, and want to give them short names without a .sh
prefix
Whenever I rename them manually and remove this file suffix, after a few seconds the suffix returns. I thought this might be Spotlight, so I transferred this folder into Spotlights 'Privacy' tab. This at least removed a lot of the metadata of the file, but the automatic renaming of the file to include the suffix still continues.
I tried renaming the files using three methods: mv file.sh file
and also Finder and also my text editor. All of them appear to succeed, but after a few seconds the file reverts to the original name with a suffix.
This behaviour is seen not just in .sh
files, but .py
and others as well. It is as if OSX is forcing me to keep the file extension.
By the way, I don't want simply to make the suffix invisible in Finder. I want to remove the suffix so that I can type shorter commands at the terminal.
How did you rename the files? How long does the new name stay? Try in a bash terminal? – Xen2050 – 2019-03-14T03:29:24.577
I have edited the question to give these details. – Tim – 2019-03-14T05:07:10.757
This very likely has nothing to do with Bash or Python. Have you tried renaming any other files? – l0b0 – 2019-03-14T08:04:59.380
1A better way to handl the problem would be to define aliases in your shell:
alias foobar='foobar.sh'
– xenoid – 2019-03-14T08:13:27.417Mac OS X isn't doing this. At least certainly not for me on 10.13 High Sierra. Look for some extension/daemon/agent you have running that could be doing this for you. Create a test acct on your Mac, log into that, and repeat the test. If it's happening on the test acct, then it's a system-wide extension/etc, if not then it's just something in your acct, so you can try logging in in "safe" mode or whatever they call it, so if that clears it from you acct. – jimtut – 2019-03-15T18:37:02.703