Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions scripts/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ function isAlphaNumeric() {
# if no given directory, it checks in the current directory
# returns 1 if it exists, 0 otherwise
function fileExists() {

# Handle case where input is '*'
set -f

if [[ "$1" =~ ^\ *\*\ *$ ]]; then
echo 0
fi

if [ -z "$2" ]; then
if [ -e "$1" ]; then
echo 1
Expand Down Expand Up @@ -488,4 +496,18 @@ function isStringColumn() {
function isLengthLessThan() {
awk -v col="$2" -v num="$3" '
BEGIN { FS=":"; flag = 1;} { if (length($col) >= num) { flag = 0; exit } } END { print flag }' "$1"
}

#Check if an operator is valid or not
function valid_op() {
# List of recognized operators
operators=("=" "!=" "<" ">" "<=" ">=")

# Check if the operator is in the list
if [[ ! " ${operators[@]} " =~ " $1 " && $1 != "" ]]; then
output+="Operator $op is not recognized\n"
echo 0
else
echo 1
fi
}
Loading