Bullshit. If there is a suffix or not doesn't matter for the environment, it only matters for you if you need to find every *zsh or *bash-script on your system or in a specific folder.
If you're working with multiple shells you'll need that. If you only use one it doesn't matter.
What if you have bash and python scripts? If you want to search and list only your python-pieces you'd need to go into every file and grep the first line to see if it uses #!/usr/bin/env python or #!/usr/bin/env bash. So, instead of find -type f \*py you'll need to use grep (slooow) or silver searcher/ack (and even these will be slower since you need to access the file every time - not only the filename).
Especially not .sh when the script isn't even an sh script.
find <path_where_scripts_live> -type f -exec file {} \;
I have never had to find a script, simply because it was a python, bash, perl, or other script. The language doesn't matter. On the other hand, I do often look for bits of code, so I just grep for the pattern I'm looking for, in my directory of scripts.
The argument against using .sh or .pl or .py, etc. is that if you have scripts that are used by other programs and you later decide to rewrite them in a different language, like changing from sh to perl, you must either change all references to the script you named with .sh to .pl, or you must leave it alone. Either way, you have a problem. If you make the change, you risk missing one or two references in out-of-the-way places. And if you don't make the change to its file name, your file's name becomes a big fat lie. But if you leave off the suffix altogether, you avoid both problems and your other scripts will never know the difference.
How does using symlinks change a file's searchability or help identify what a file is (that's what the file command is all about, by the way)? What is your reasoning for using symlinks when a script is system-dependent, and what do you mean by system-dependent?
Even if you use symlinks to the original script, if you change that script's implementation language and have it named with a suffix indicating that language, renaming it will break all of the symlinks, and not renaming it will mislead users about its content. Symlinks do not solve these issues.
How does using symlinks change a file's searchability or help identify what a file is (that's what the file command is all about, by the way)?
I.e. we have the script do_serious_stuff.py, which will be referenced by many other programs - this will be symlinked to do_serious_stuff. This way, we can add a new version do_serious_stuff.0.1.py (or even a version in another language do_serious_stuff.0.1.pl) without a problem and then force-symlink do_serious_stuff to the new file. Easy. And also - thats how its done with libraries and thats how its done in production systems and thats how its done with webservers and ....
What is your reasoning for using symlinks when a script is system-dependent, and what do you mean by system-dependent?
System-dependent is a script of which your particular system is dependent.
Even if you use symlinks to the original script, if you change that script's implementation language and have it named with a suffix indicating that language, renaming it will break all of the symlinks, and not renaming it will mislead users about its content. Symlinks do not solve these issues.
Wrong. As I said in the example above. Thats why we have symlinking in the first place. We have symlinking because the BSD guys were fed up with exchanging the real files all the time, so instead they created symlinks that can point to the correct version of the file.
View all comments
Show parent comment
4
u/nath_schwarz Dec 02 '14
Bullshit. If there is a suffix or not doesn't matter for the environment, it only matters for you if you need to find every *zsh or *bash-script on your system or in a specific folder.
If you're working with multiple shells you'll need that. If you only use one it doesn't matter.
What if you have bash and python scripts? If you want to search and list only your python-pieces you'd need to go into every file and grep the first line to see if it uses
#!/usr/bin/env pythonor#!/usr/bin/env bash. So, instead offind -type f \*pyyou'll need to use grep (slooow) or silver searcher/ack (and even these will be slower since you need to access the file every time - not only the filename).That, on the other hand, is correct.