Jelajahi Sumber

reinstate check for w3m

This had been removed here to allow running the tool when w3m
is not installed; a better way would be to move the check until
after options have been parsed and possibly an alternate browser
has been requested.  But that would be a different change set /
PR, so putting this back here for now.
Jan Schaumann 5 tahun lalu
induk
melakukan
806687ccf7
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      tmpmail

+ 4 - 2
tmpmail

@@ -188,7 +188,8 @@ list_emails() {
     #  5
     #
     # We can then put those results into the foor loop
-    for index in $(seq 1 "$DATA_LENGTH"); do
+    index=1
+    while [ $index -le "${DATA_LENGTH}" ]; do
         # Since arrays in JSON data start at 0, we must subtract
         # the value of $index by 1 so that we dont miss one of the
         # emails in the array
@@ -203,6 +204,7 @@ list_emails() {
         # but that would not work in our case as the email subject could have multiple white spaces
         # and 'column' would split the words that are seperated by white space, in different columns.
         INBOX="$INBOX$ID ||$FROM ||$SUBJECT\n"
+        index=$(( index + 1 ))
     done
 
     # Show the emails cleanly
@@ -282,7 +284,7 @@ print_error() {
 
 main() {
     # Iterate of the array of dependencies and check if the user has them installed
-    for dependency in jq curl; do
+    for dependency in jq w3m curl; do
         if ! command -v "$dependency" >/dev/null 2>&1; then
             print_error "Could not find '$dependency', is it installed?"
         fi