Skip to content

Should extract duplicate code in scripts  #73

@duchainer

Description

@duchainer

See sara_install/script/

This code is the exact same in more than 4 files:

if [[ $SHELL_EXTENSION == "bash" ]]
then
    WSDIR=$(readlink -f $(dirname $(dirname "${BASH_SOURCE[0]}")))
elif [[ $SHELL_EXTENSION == "zsh" ]]
then
    WSDIR="$(dirname $(readlink -f ${0%/*}))";
else
    echo "This shell is not supported. Please use bash or zsh."
    exit -1 # Not permitted
fi

Later modification will become difficult to do correctly if it stays

Maybe source a separate file containing the identical code or use an external function.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions