Complete the code to print the current working directory in a POSIX-compliant way.
echo [1]The pwd command prints the current working directory and is POSIX-compliant.
Complete the code to check if a file named 'data.txt' exists in a POSIX-compliant way.
if [ [1] "data.txt" ]; then echo "File exists"; fi
-d which checks only for directories.-f which checks only for regular files.-s which checks if file size is greater than zero.The -e test checks if a file or directory exists and is POSIX-compliant.
Fix the error in the script to assign the output of the 'date' command to a variable in a POSIX-compliant way.
current_date=[1]Using $(date) is POSIX-compliant for command substitution.
Fill both blanks to create a POSIX-compliant loop that prints numbers 1 to 5.
i=1 while [ [1] ]; do echo $i i=[2] done
The condition [ $i -le 5 ] checks if i is less or equal to 5, and i=$((i + 1)) increments i in a POSIX-compliant way.
Fill all three blanks to create a POSIX-compliant script that creates a directory if it does not exist and then changes into it.
if [ ! -d [1] ]; then [2] [3] fi
The script checks if 'myfolder' directory does not exist, then creates it with mkdir -p. The cd command is not used here because the instruction only asks to create and then change into it, but the blank is only for creation.