<commit_before>local bash = {}

bash.indent = [=[
indent() {
    local n="${1:-4}"
    local p=""
    for i in `seq 1 $n`; do
        p="$p "
    done;

    local c="s/^/$p/"
    case $(uname) in
      Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries
      *)      sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data
    esac
}
]=]

bash.prefix = [=[
prefix() {
  local p="${1:-prefix}"
  local c="s/^/$p/"
  case $(uname) in
    Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries
    *)      sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data
  esac
}
]=]

bash.upper = [=[
upper() {
    echo -n "$1" | tr '[a-z]' '[A-Z]'
}
]=]

bash.xterm = "TERM=xterm"

bash.errexit_on = "set -e"

bash.version = "bash --version"

bash.load_profile = ". /etc/profile"

bash.lock = [=[
essh_bash_lockdir=${TMPDIR:-/tmp}
essh_bash_lockdir=${essh_bash_lockdir%/}/essh_lock.${ESSH_TASK_NAME:-unknown}
essh_bash_trylocking=0
essh_bash_trylocking_count=0

while [ ${essh_bash_trylocking} -eq 0 ]
do
    if ( mkdir ${essh_bash_lockdir} ) 2> /dev/null; then
        echo $$ > ${essh_bash_lockdir}/pid
        # break loop
        essh_bash_trylocking=1
        trap 'rm -rf "$essh_bash_lockdir"; exit $?' INT TERM EXIT
    else
        # could not get a lock, try to check pid.
        if ps -p $(cat ${essh_bash_lockdir}/pid) > /dev/null 2>&1; then
            # pid exists.
            echo "Lock exists: $essh_bash_lockdir owned by $(cat ${essh_bash_lockdir}/pid)" >&2
            exit 1
        else
            # pid does not exist. remove lockdir
            echo "Lock exists: $essh_bash_lockdir owned by $(cat ${essh_bash_lockdir}/pid). But the process terminated." >&2
            echo "Trying to clean the lock and start it again..." >&2
            rm -rf "$essh_bash_lockdir"

            essh_bash_trylocking_count=$((essh_bash_trylocking_count+1))

            if [ "$essh_bash_trylocking_count" -gt 5 ]; then
                echo "Could not get the lock." >&2
                exit 1<commit_msg>remote load_profile in bash module<commit_after>local bash = {}

bash.indent = [=[
indent() {
    local n="${1:-4}"
    local p=""
    for i in `seq 1 $n`; do
        p="$p "
    done;

    local c="s/^/$p/"
    case $(uname) in
      Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries
      *)      sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data
    esac
}
]=]

bash.prefix = [=[
prefix() {
  local p="${1:-prefix}"
  local c="s/^/$p/"
  case $(uname) in
    Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries
    *)      sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data
  esac
}
]=]

bash.upper = [=[
upper() {
    echo -n "$1" | tr '[a-z]' '[A-Z]'
}
]=]

bash.xterm = "TERM=xterm"

bash.errexit_on = "set -e"

bash.version = "bash --version"

bash.lock = [=[
essh_bash_lockdir=${TMPDIR:-/tmp}
essh_bash_lockdir=${essh_bash_lockdir%/}/essh_lock.${ESSH_TASK_NAME:-unknown}
essh_bash_trylocking=0
essh_bash_trylocking_count=0

while [ ${essh_bash_trylocking} -eq 0 ]
do
    if ( mkdir ${essh_bash_lockdir} ) 2> /dev/null; then
        echo $$ > ${essh_bash_lockdir}/pid
        # break loop
        essh_bash_trylocking=1
        trap 'rm -rf "$essh_bash_lockdir"; exit $?' INT TERM EXIT
    else
        # could not get a lock, try to check pid.
        if ps -p $(cat ${essh_bash_lockdir}/pid) > /dev/null 2>&1; then
            # pid exists.
            echo "Lock exists: $essh_bash_lockdir owned by $(cat ${essh_bash_lockdir}/pid)" >&2
            exit 1
        else
            # pid does not exist. remove lockdir
            echo "Lock exists: $essh_bash_lockdir owned by $(cat ${essh_bash_lockdir}/pid). But the process terminated." >&2
            echo "Trying to clean the lock and start it again..." >&2
            rm -rf "$essh_bash_lockdir"

            essh_bash_trylocking_count=$((essh_bash_trylocking_count+1))

            if [ "$essh_bash_trylocking_count" -gt 5 ]; then
                echo "Could not get the lock." >&2
                exit 1
{'fraction_non_alphanumeric': 0.15371498172959805, 'fraction_numerical': 0.0097442143727162, 'mean_word_length': 2.387788778877888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3357195', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1492, 'n_words': 409}