From 7e5385fd2208161c8cb26041457f30e5e4752e06 Mon Sep 17 00:00:00 2001 From: Gabriele Tijunaityte Date: Wed, 4 Sep 2024 17:15:54 +0200 Subject: [PATCH 1/2] Solve confusion with bash script --- index.Rmd | 4 ++-- index.html | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/index.Rmd b/index.Rmd index c9fb4dc..07d25da 100644 --- a/index.Rmd +++ b/index.Rmd @@ -589,7 +589,7 @@ rm input.tif ```{block, type="alert alert-success"} > **Question 6**: Try to write to calculate the NDVI using the lines above in a nice and short shell script. -- Hint 1: `cd ../data` (to move back from the Bash directory and move into the data directory) +- Hint 1: use `cd ..` to move to the parent directory - Hint 2: No spaces in file names are allowed and try to use variables e.g. `fn=$(ls *.tif)` ``` @@ -601,7 +601,7 @@ Let's now check if the range of the NDVI values makes sense, and make a nice scr echo "teamname" echo "Current date" echo "Calculate LandSat NDVI" -mkdir -p data output +mkdir output fn=data/*.tif echo "The input file(s): $fn" outfn=output/ndvi.tif diff --git a/index.html b/index.html index 68e9f80..78d4ebd 100644 --- a/index.html +++ b/index.html @@ -24,8 +24,8 @@ } }); -

WUR Geoscripting -

+WUR logo

Linux terminal & Bash

@@ -1871,8 +1871,7 @@

Using the GDAL library from the terminal

  • -Hint 1: cd ../data (to move back from the Bash directory -and move into the data directory) +Hint 1: use cd .. to move to the parent directory
  • Hint 2: No spaces in file names are allowed and try to use variables @@ -1887,7 +1886,7 @@

    Using the GDAL library from the terminal

    echo "teamname" echo "Current date" echo "Calculate LandSat NDVI" -mkdir -p data output +mkdir output fn=data/*.tif echo "The input file(s): $fn" outfn=output/ndvi.tif From b0f8cd82f5ee254473ca22b7a54f65098118be7c Mon Sep 17 00:00:00 2001 From: Gabriele Tijunaityte Date: Wed, 4 Sep 2024 17:17:05 +0200 Subject: [PATCH 2/2] include -p for mkdir --- index.Rmd | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.Rmd b/index.Rmd index 07d25da..132fa9e 100644 --- a/index.Rmd +++ b/index.Rmd @@ -601,7 +601,7 @@ Let's now check if the range of the NDVI values makes sense, and make a nice scr echo "teamname" echo "Current date" echo "Calculate LandSat NDVI" -mkdir output +mkdir -p output fn=data/*.tif echo "The input file(s): $fn" outfn=output/ndvi.tif diff --git a/index.html b/index.html index 78d4ebd..1d5590f 100644 --- a/index.html +++ b/index.html @@ -1886,7 +1886,7 @@

    Using the GDAL library from the terminal

    echo "teamname" echo "Current date" echo "Calculate LandSat NDVI" -mkdir output +mkdir -p output fn=data/*.tif echo "The input file(s): $fn" outfn=output/ndvi.tif