File: bash%2B

package info (click to toggle)
git-subrepo 0.4.9-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,552 kB
  • sloc: sh: 7,074; makefile: 273; perl: 226
file content (44 lines) | stat: -rwxr-xr-x 1,224 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
#------------------------------------------------------------------------------
# Bash+ - Modern Bash Programming
#
# Copyright (c) 2013-2020 Ingy döt Net
#------------------------------------------------------------------------------

set -e
shopt -s compat31 &>/dev/null || true

#------------------------------------------------------------------------------
# Determine how `bash+` was called, and do the right thing:
#------------------------------------------------------------------------------
if [[ ${BASH_SOURCE[0]} != "$0" ]]; then
  # 'bash+' is being sourced:
  [[ ${BASH_SOURCE[0]} =~ /bin/bash\\+$ ]] || {
    echo "Invalid Bash+ path '${BASH_SOURCE[0]}'" 2> /dev/null
    exit 1
  }
  source "${BASH_SOURCE[0]%/bin/*}"/lib/bash+.bash || return $?
  bash+:import "$@"
  return $?

else
  if [[ $# -eq 1 ]] && [[ $1 == --version ]]; then
    echo 'bash+   version 0.0.9'
  else
    cat <<'...'

Greetings modern Bash programmer. Welcome to Bash+!

Bash+ is framework that makes Bash programming more like Ruby and Perl.

See: https://github.com/bpan-org/bashplus

If you got here trying to use bash+ in a program, you need to source it:

    source bash+

Happy Bash Hacking!

...
  fi
fi