File: get-shell-files.sh

package info (click to toggle)
apptainer 1.4.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,780 kB
  • sloc: sh: 3,329; ansic: 1,706; awk: 414; python: 103; makefile: 54
file content (22 lines) | stat: -rwxr-xr-x 685 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env sh
# Copyright (c) Contributors to the Apptainer project, established as
#   Apptainer a Series of LF Projects LLC.
#   For website terms of use, trademark policy, privacy policy and other
#   project policies see https://lfprojects.org/policies
#
# attempt to find all sh/bash files in source directories
#

get_shell_shebang_files() {
  grep -rm1 ^ -- * | grep -vE "^vendor|^builddir" | grep -E ':#!.*bin.*sh( |$)' | sed -e 's|:#!.*||'
}

get_shell_suffix_files() {
  find . -type f -name "*.sh" | sed -e 's|^\./||' | grep -vE '^vendor|^builddir'
}

get_all_unique_files() {
  (get_shell_shebang_files && get_shell_suffix_files) | sort -u
}

get_all_unique_files "$@"