What is the right way of assigning the output of lowercase_last2 to another variable? What am I doing wrong below?
I have a shell script test_lowercase_last.sh that defines a couple of functions
#!/bin/bash
function lowercase_last2() (
PART2=/"${1##*/}"
PART1=${1%"$PART2"}
PART2_LOWER=$(echo "$PART2" | tr '[:upper:]' '[:lower:]')
echo ${PART1}${PART2_LOWER}
)
function basic() (
echo "Testing"
)
and another script that means to use them
#!/bin/bash
echo $(basic)
echo $(lowercase_last /home/santiago/Test)
But this is what I get
$ source test_lowercase_last.sh
$ ./test_bash_func.sh
./test_bash_func.sh: line 2: basic: command not found
./test_bash_func.sh: line 3: lowercase_last: command not found
I actually mean to assign the output of lowercase_last2 to another variable, but I guess once I get this right, it should be straightforward.
Then the question.
sourcethe library with the functions in the script that needs those functions..shextension on a library that's using deliberately POSIX-noncompliant syntax is misleading at best.function foo() {is merging the legacy-kshfunction foo {syntax and the POSIX-compliantfoo() {syntax in a way that's not compatible with either legacy ksh or the POSIX specification..bashextension. Whereas executables (a category including shell scripts as opposed to shell libraries) should have no extension at all; you runpip, notpip.py; and you runls, notls.elf.