Yes I know this have been asked before and I have been looking. Im a newbie when it comes to linux so here goes.
WSL1 ubuntu 20.04 Mapped drive to my C:drive
I have a c:\test.sh code
#!/bin/bash
installDependencies()
{
# TODO ForEach or For loop would be better here
if [ "$(which curl | grep -c 'bin')" -ne 0 ]; then
curl --version | head -n 1;
echo -e "Curl installed: $TICK"
fi
if [ "$(which file | grep -c 'bin')" -ne 0 ]; then
file --version | head -n 1;
echo -e "File installed: $TICK"
fi
}
/mnt/c/$ type ./test.sh
It runs but does not show the echo's What am I missing?
looking at the threads seems that I'm either missing something or people have assumptions that I am missing.
Cheers in advanced.
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3 Curl installed:
file-5.38 File installed:
Update-----
Hi this is an existing Script that I have been trying to break down. I thought it would be easier for me to break down sections.
But reading has just pointed somethings out to me such as installDependencies() is similar to a function. So it will do nothing until its called.
Apologies what a week, and I was looking way to closely at this. Its not my first mistake and it wont be my last. Appreciate the response and for the brain nudge. For all that responded to the newbie thanks.
The tick variables was further down the script.
# Setting variables
TICK="\e[32m✔\e[0m"
CROSS="\e[31m✘\e[0m"
WARNING="\e[33m‼\e[0m"
Update---------
# Let's get started
echo "Ok, here we go... "
echo "==================================================================="
installDependencies
sleep 10
echo "==================================================================="
I think the dependences and installed components are to just output if something is installed.
We have other components that then install things like HomeBrew with are also functions.
echo "==================================================================="
installHomeBrew
sleep 10
echo "==================================================================="
Again thanks for all the help will look at replacing echo with printf. As well as starting to look at dev/null and making the script a bit more uniform.