kea-classrooms / ITA-BBS-Amalie956

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

Create another script that fixes things #3

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

Create another script; fix-samples.sh and put it in the root of the repository (next to setup-samples.sh).

Use the script to record the commands you executed in the previous issue to sort the misplaced and misspelled files.

So that you can run the two scripts in sequence.

 ./setup-samples.sh # Creates sample files
 ./fix-samples.sh # bring order to the samples
Amalie956 commented 1 year ago

Jeg startede med at kopirer setup-samples.sh så det andet hedder fix-samples.sh:

cp setup-samples.sh fix-samples.sh

Derefter kopirede jeg dette ind:

cd samples/
mv animals/countries/ .
mv countries/movies/ .
mv animals/Monkies.txt animals/Monkeys.txt 
cat animals/Monkeys.txt 
echo animals/Monkeys.txt 
echo Monkeys > animals/Monkeys.txt 
mv movies/Germany.txt countries/
mv countries/.apes.txt animals/
cd -

billede

Tilsidst skrev jeg i terminalen:

rm -r samples/ && ./setup-samples.sh && ./fix-samples.sh

Det ser nu sådan her ud: billede billede

History:

 1  mkdir samples
    2  mkdir samples/animals
    3  mkdir samples/animals/countries
    4  mkdir samples/animals/countries/movies
    5  ANIMALS=('Apes' 'Elephants' 'Elephant babies' 'Monkies' 'apes')
    6  COUNTRIES=('Denmark' 'Sweden' 'USA' 'France' 'Italy' '.apes' 'North Korea')
    7  MOVIES=('Batman' 'Sex And The City' 'JFK' 'Poltergeist' 'Germany')
    8  cd samples/animals 
    9  for id in ${ANIMALS[@]}; do echo $id >> $id.txt; done
   10  cd countries
   11  for id in ${COUNTRIES[@]}; do echo $id >> $id.txt; done
   12  cd movies
   13  for id in ${MOVIES[@]}; do echo $id >> $id.txt; done
   14  cd ..
   15  rm --help
   16  rm -r samples/
   17  cd ..
   18  rm -r samples/
   19  clear
   20  touch setup-samples.sh
   21  ls
   22  ls -l
   23  ls -la
   24  ./setup-samples.sh
   25  chmod
   26  chmod --help
   27  man chmod
   28  chmod +x setup-samples.sh 
   29  ls -la
   30  ./setup-samples.sh 
   31  clear
   32  rm -r samples/
   33  history
   34  clear
   35  ./setup-samples.sh 
   36  cd samples/
   37  mv animals/countries/ .
   38  mv countries/movies/ .
   39  mv animals/Monkies.txt animals/Monkeys.txt 
   40  cat animals/Monkeys.txt 
   41  echo animals/Monkeys.txt 
   42  echo Monkeys > animals/Monkeys.txt 
   43  mv movies/Germany.txt countries/
   44  mv countries/.apes.txt animals/
   45  cd -
   46  cp samples/animals/.apes.txt  .
   47  rm .apes.txt 
   48  cp setup-samples.sh fix-samples.sh
   49  clear
   50  history
   51  rm -r samples/
   52  ./setup-samples.sh 
   53  rm -r samples/
   54  ./setup-samples.sh 
   55  history
   56  rm -r samples/
   57  ./setup-samples.sh 
   58  history
   59  rm -r samples/ && ./setup-samples.sh && ./fix-samples.sh 
   60  rm -r samples/ && ./setup-samples.sh
   61  rm -r samples/ && ./fix-samples.sh 
   62  touch setup-samples.sh
   63  ./setup-samples.sh 
   64  rm -r samples/ && ./setup-samples.sh
   65  rm -r samples/ && ./setup-samples.sh && ./fix-samples.sh 
   66  ls -la