LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2019, 08:17 AM   #16
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888

Quote:
Originally Posted by wpeckham View Post
Sonce the BASH scripts are identified as "Bourne-Again shell script" in my version, my identification of bash shells in a folder might look like
Code:
file /usr/bin/* | grep Bourne
Two remarks:
- Bourne-Again shell script will only be shown for scripts that have
#!/bin/bash
as their first line. Others may have POSIX shell script (/bin/sh or NO hashbang line), Korn shell script, Tenex C shell script or even Perl script and python script, depending ON that first line (or its lack) IN the script
- shell scripts (of any kind) can be located in the /usr/sbin, the /*bin and even the /usr/libexec directories too, not just in /usr/bin
 
1 members found this post helpful.
Old 12-05-2019, 05:51 PM   #17
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,765

Rep: Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764
Quote:
Originally Posted by ehartman View Post
Two remarks:
- Bourne-Again shell script will only be shown for scripts that have
#!/bin/bash
as their first line. Others may have POSIX shell script (/bin/sh or NO hashbang line), Korn shell script, Tenex C shell script or even Perl script and python script, depending ON that first line (or its lack) IN the script
- shell scripts (of any kind) can be located in the /usr/sbin, the /*bin and even the /usr/libexec directories too, not just in /usr/bin
True, although the question I had in mind was specific to BASH scripts. If you wanted to find ALL scripts you could filter on "script" for those results.
There is nothing that limits scripts to those folders! Although one might expect that they would normally be in a folder somewhere in the default path, there is nothing to enforce such a restriction.
 
Old 12-06-2019, 02:04 AM   #18
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Just pointing out that there's a whole lot of "professional" shell scripting going on on any Linux distro...

Checking $PATH is a quick way to show that.

Yes, to make it more complete one should probably start with
Code:
find /
Better:
Code:
for path in ${PATH//:/ }; do for i in $path/*; do file "$i"| grep -w shell; done; done | wc -l
and on my system that returns:
Code:
546
edit:
checking for explicit Bash scripts only is misleading because most scripts are marked '#!/bin/sh', yet the executing shell is often still bash.

Last edited by ondoho; 12-06-2019 at 02:05 AM.
 
  


Reply

Tags
bash recursion



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
New to Bash | Need help with recursion. VauxhallVXR Programming 2 05-30-2009 05:47 PM
using recursion in bash script drkstr Linux - Software 4 07-09-2006 08:48 PM
Bash Local Variable Recursion With Array jshivers Programming 0 06-16-2006 04:31 PM
tar: '--no-recursion' option doesn't prevent recursion Earl Parker II Slackware 12 08-17-2004 02:49 AM
Writing bash script with recursion.. ray5_83 Programming 4 08-04-2004 05:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration