@@ -383,8 +383,8 @@ function printOneLocation(){
383
383
}
384
384
385
385
function printAllLocations(){
386
- locations=$( curl -s " http://localhost/Locations/" )
387
- length=$( curl -s " http://localhost/Locations/" | jq length)
386
+ locations=$( curl -s " http://localhost/Locations/" )
387
+ length=$( curl -s " http://localhost/Locations/" | jq .locations | jq length)
388
388
for i in ` seq 0 $length ` ;
389
389
do
390
390
current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
@@ -409,7 +409,7 @@ function printLocationByID(){
409
409
function printLocationByCity(){
410
410
if [ -n " $city " ]; then
411
411
locations=$( curl -s " http://localhost/Locations/city=" $city " " )
412
- length=$( curl -s " http://localhost/Locations/city=" $city " " | jq length)
412
+ length=$( curl -s " http://localhost/Locations/city=" $city " " | jq .locations | jq length)
413
413
for i in ` seq 0 $length ` ; do
414
414
current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
415
415
printOneLocation " $current_movie "
@@ -424,7 +424,7 @@ function printLocationByCity(){
424
424
function printLocationByCountry(){
425
425
if [ -n " $country " ]; then
426
426
locations=$( curl -s " http://localhost/Locations/country=" $country " " )
427
- length=$( curl -s " http://localhost/Locations/country=" $country " " | jq length)
427
+ length=$( curl -s " http://localhost/Locations/country=" $country " " | jq .locations | jq length)
428
428
for i in ` seq 0 $length ` ; do
429
429
current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
430
430
printOneLocation " $current_movie "
0 commit comments