<commit_before># shell-proteins

## What is shell-proteins?

Shell Proteins is an easily extensible framework to write and reuse BASH functions in your Shell scripts.

### Usage

Just write a simple function, save it in a .sh file and push it to GitHub.

```
#!/bin/bash

# Function: print_usage
# 
# input params: any parameters that should be printed in usage line (space separated)
# output: standard output with text how to use a BASH script

function print_usage() {
  args=("$@")
  echo ""
  echo "Usage:"
  echo -n "$0 "
  for (( i=0; i < $#; i++ )); do
    echo -n "[${args[$i]}] "
  done
  echo ""
}
```

You can then reuse it by simply adding one line in your Shell scripts:

``` 
#!/bin/bash
source "$HOME/bin/shell-proteins/bash/base.inc.sh" 

# Import core function
protein_require "core/print_usage"

[...]

# This is an actual usage of a simple function:
print_usage "first_param" "second_param"
```

You can also use your own functions:

```
#!/bin/bash
source "$HOME/bin/shell-proteins/bash/base.inc.sh"
protein_require "grzegorzblaszczyk/shell-proteins-ext/bash/ubuntu/verify_if_installed_with_dot" "https://raw.githubusercontent.com/grzegorzblaszczyk/shell-proteins-ext/master/bash/ubuntu/verify_if_installed_with_dot.inc.sh"

FFMPEG=`which ffmpeg`

echo -n "Verifying if all necessary software is installed ."
verify_if_installed_with_dot ffmpeg ${FFMPEG}
echo "[OK]"

```

If you have ffmpeg installed on your system, then the result would be:

```
Verifying if all necessary software is installed ..[OK]
```

If you do NOT have ffmpeg installed on your system, then the result of this script would be:

```
Verifying if all necessary software is installed ..
Please install ffmpeg on your system. Probably you can do it by running:
sudo apt-get install ffmpeg
```


Naming based on: http://www.scientificamerican.com/article/how-are-seashells-created/

## Installation

```\curl -sSL https://raw.githubusercontent.com/grzegorzblaszczyk/shell-proteins/master/install.sh | bash```<commit_msg>ADD: more explanation in README<commit_after># shell-proteins

## What is shell-proteins?

Shell Proteins is an easily extensible framework to write and reuse BASH functions in your Shell scripts.

### Usage

Just write a simple function, save it in a .sh file and push it to GitHub.

```
#!/bin/bash

# Function: print_usage
# 
# input params: any parameters that should be printed in usage line (space separated)
# output: standard output with text how to use a BASH script

function print_usage() {
  args=("$@")
  echo ""
  echo "Usage:"
  echo -n "$0 "
  for (( i=0; i < $#; i++ )); do
    echo -n "[${args[$i]}] "
  done
  echo ""
}
```

You can then reuse it by simply adding one line in your Shell scripts:

``` 
#!/bin/bash
source "$HOME/bin/shell-proteins/bash/base.inc.sh" 

# Import core function
protein_require "core/print_usage"

[...]

# This is an actual usage of a simple function:
print_usage "first_param" "second_param"
```

You can also use your own functions:

```
#!/bin/bash
source "$HOME/bin/shell-proteins/bash/base.inc.sh"
protein_require "grzegorzblaszczyk/shell-proteins-ext/bash/ubuntu/verify_if_installed_with_dot" "https://raw.githubusercontent.com/grzegorzblaszczyk/shell-proteins-ext/master/bash/ubuntu/verify_if_installed_with_dot.inc.sh"

FFMPEG=`which ffmpeg`

echo -n "Verifying if all necessary software is installed ."
verify_if_installed_with_dot ffmpeg ${FFMPEG}
echo "[OK]"

```
Shell Proteins will download the script from a remote location if you have not yet it installed locally. It will then reuse the function in your script.

If you have ffmpeg installed on your system, then the result would be:

```
Verifying if all necessary software is installed ..[OK]
```

If you do NOT have ffmpeg installed on your system, then the result of this script would be:

```
Verifying if all necessary software is installed ..
Please install ffmpeg on your system. Probably you can do it by running:
sudo apt-get install ffmpeg
```


Naming based on: http://www.scientificamerican.com/article/how-are-seashells-created/

## Installation

```\curl -sSL https://raw.githubusercontent.com/grzegorzblaszczyk/shell-proteins/master/install.sh | bash```
{'fraction_non_alphanumeric': 0.11323003575685339, 'fraction_numerical': 0.0009535160905840286, 'mean_word_length': 4.297979797979798, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3968741', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1336, 'n_words': 470}