kea-classrooms / ITA-BBS-Amalie956

ITA-BBS-Amalie956 created by GitHub Classroom
0 stars 1 forks source link

Support whitespaces in file names #4

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

Apparently the script itself i broken. It doesn't handle whitespaces that well.

We had expected a file called Sex And The City.txt but instead we got Sex.txt, And.txt, The.txt and City.txt. Same with Elephant babies

Fix that in the script.

Hint: you need to use quotes " here and there to make it work

Amalie956 commented 1 year ago

Der skal være "double quotes" omkring variablerne:

cd samples/animals 
  for id in "${ANIMALS[@]}"
do
  echo $id >> "$id.txt"
done

cd countries
  for id in "${COUNTRIES[@]}"
do
  echo $id >> "$id.txt"
done

cd movies
  for id in "${MOVIES[@]}"
do
  echo $id >> "$id.txt"
done