Tests to be performed while evaluating the Minishell / while building up Minishell:
- when launching bash (from any application), the
envcommand will print the environmental variables - if a student unsets the variables before launching Minishell, the Minishell program must be able to replicate bash behaviour, according to the subject;
unset PATH- launch minishell
echo $PATHshould result in the PATH variable being printedenvshould result in the environmental list to be printed, including the PATH variable- same for PWD -> if someone unsets PWD, this variable must be recreated when launching Minishell and included in the
envlist
For PWD only, please note that if you are positioned in a symlink when opening minishell, the echo $PWD command must deliver the correct path you are on.
- in the minishell directory:
mkdir testdir ln -s testdir link- move into the link:
cd link - create another directory:
mkdir testdir2 - create another link:
ln -s testdir2 link2 - now, if you write
pwd, you should be positioned into your first link. The result should be something like:~>/..../.../minishell/link - now launch minishell from this position, e.g.:
../minishell - now write
pwd-> the result should be the same as the one you had previously, before launching minishell:~>/..../.../minishell/link - check PWD ->
echo $PWD, should be the same as the commandpwd - move into the second link:
cd link2 pwdshould result in:~>/..../.../minishell/link/link2echo $PWDshould also result in~>/..../.../minishell/link/link2unset PWDecho $PWDshould result in an empty newlinepwdshould still print the path:~>/..../.../minishell/link/link2cd ..envshould present a list without PWD in itecho $PWDshould print~>/..../.../minishell/linkpwdshould also print~>/..../.../minishell/linkecho $OLDPWDshould result in an empty space
ALTERNATIVELY, a student can choose NOT to replicate this behaviour, but to simply protect against this behaviour. This means that a student must make sure the code doesn't segfault / crash and that it throws an error / finds an alternative to not having a PATH
echo lala=>lala\necho $PWD=> should print the value of the PWD env variable followed by a newlineecho -n lol=>lolecho -n -nnnnn -nnnnnnnn=> (no empty lines; nothing to be printed)echo -nnnnnn -nnnnnn -nnnnnk=>-nnnnnkecho-nnnnnn=> errrorpwdprints the current folder one is in, no matter if$PATHexists or not- must correctly print symlinks, if within a symlink structure, such as:
:~>/..../.../minishell/symlink1/symlink2/testdir3/symlink4
export ABC=lalamust add to the env list the variable ABC with the value lalaexport A*$#$#BC=lalamust throw an errorexportmust print a list with all the env variables, displayed in alphabetical order, such as:declare -x USER="username"export ABC=lala ADF=testing AJH=oopsshould add all 3 variables to the envexport ABC=lalaandexport ABC=lalawill export the ABC variable only once, with the value 'lala'export ABC=lalaandexport ABC=lolowill export the ABC variable only once, but the second command will change its value to 'lolo'
unset ABCwill unset the variable ABC, removing it from the env variablesunset ABC ABD ABFwill unset all 3 variables from env, if they are present in the env variables
cd /should change directory to/cd /home/user/Documentsshould change the directory to/home/user/Documentscd /home/user/Documents/symlink and then write pwd-> the display should be/home/user/Documents/symlinkand not/home/user/Documents/*directory towards which the link points to*cd $OLDPWDshould change directory to the one indicated by$OLDPWDcd ..should change the directory to the one above