Lab: Conditional Logic Issues

Hello @KodeKloud

I want to report a possible issue with this lab, please check:

Hi @andrescaroc,

Check the answer at /tmp/assets/check_dir.sh.

checked,
But consider the following:

The instruction states "Create a shell script in the home directory ..." so I can use both:

  1. relative path if [ -d caleston] or
  2. absolute path if [ -d "/home/bob/caleston" ]

to check "...if the directory /home/bob/caleston exists"

The screenshot validate my solution.

Hi @andrescaroc,

you’re right the two solutions are correct but in the test, we check only one answer using the absolute path and you have to use It to pass the task.

Here is my answer and answer file output. what is the issue?

bob@caleston-lp10:~$ cat check_dir.sh

if [ -d “/home/bob/caleston” ]
then
echo “Directory Exist”
else
echo “Directory not found”
bob@caleston-lp10:~$ cat /tmp/assets/check_dir.sh

if [ -d “/home/bob/caleston” ]
then
echo “Directory exists”
else
echo “Directory not found”

image

Hello, @Damith
I am not denying what message you would like to print with echo. But validation is looking for Directory exists. It’s available along with the question as well.
I tried and validation is working correctly without any issue.