-
-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shuf(1) is not part of POSIX, neither is 'sort -R' #45
Conversation
Looks good. Just tried that on OpenBSD and then realised that seq(1) is also not part of POSIX. Solution found on Stackexchange with awk(1) here. Do you mind implementing that too or should I create another PR? |
Nathanael <notifications@github.com> wrote:
Looks good. Just tried that on OpenBSD and then realised that seq(1) is also not part of POSIX.
If DATA_LENGTH is a number then you can
```
@@ -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
```
|
Looks good. Thanks! |
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.
tmpmail
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question and extension to check for required tools dependent on cli options would apply for:
awk
, sort
, cut
, tail
A new feature was added in #46 and it uses |
Siddharth Dushantha <notifications@github.com> wrote:
A new feature was added in #46 and it uses `seq`.
Would you like to update the code to not include it?
You should be able to use the same logic here.
That is, instead of
```
for i in $(seq start end); do
...
done
```
use
```
i=start
while [ $i -le end ]; do
...
i=$(( i + 1 ))
done
```
|
This should address issue #44.