Skip to content

Conversation

@arafatx
Copy link

@arafatx arafatx commented Oct 23, 2022

  • Made the code more readable with the new syntax and fixed some variable declarations that should follow variable scope. Also removed unnecessary semicolons in code and formatting the code indention in beautiful way.

eg:

$? == 0 (BAD)
$? -eq 0 (GOOD)

$? != 0 (BAD)
$? -ne 0 (GOOD)

BAD:

function ansure_accesstoken () {
local NOW = date +%s
}

GOOD:

ansure_accesstoken () {
local now = $(date +%s)
}

BAD:

let NUMBEROFCHUNK=($FILE_SIZE/1024/1024+$CHUNK_SIZE-1)/$CHUNK_SIZE

GOOD:

((number_of_chunk = (file_size / 1024 / 1024 + CHUNK_SIZE - 1) / CHUNK_SIZE))

  • Add little more test for config file before source it to prevent error

  • Fixed return code when calling check_http_response function, it did not have an argument of '$?' at the end.

  • Fixed typo

+ Made the code more readable with the new syntax and fixed some variable declarations that should follow variable scope. Also removed unnecessary semicolons in code and formatting the code indention in beautiful way.

eg:

$? == 0 (BAD)
$? -eq 0 (GOOD)

$? != 0 (BAD)
$? -ne 0 (GOOD)


BAD:

function ansure_accesstoken () {
     local NOW = `date +%s` 
}

GOOD:

ansure_accesstoken () {
     local now = $(date +%s) 
}


BAD: 

let NUMBEROFCHUNK=($FILE_SIZE/1024/1024+$CHUNK_SIZE-1)/$CHUNK_SIZE

GOOD:

((number_of_chunk = (file_size / 1024 / 1024 + CHUNK_SIZE - 1) / CHUNK_SIZE))

+ Add little more test for config file before source it to prevent error

+ Fixed return code when calling check_http_response function, it did not have an argument of '$?' at the end.
@arafatx arafatx changed the title + Made the code more readable, Fixed code .. Made the code more readable, Fixed code and typo Oct 23, 2022
@Feriman22
Copy link

Feriman22 commented Aug 20, 2025

$? == 0 (BAD)
$? -eq 0 (GOOD)

$? != 0 (BAD)
$? -ne 0 (GOOD)

Even better if you check the command directly. Like:

command && echo "Success" || echo "Failed"

or

if command; then
  echo "Success"
else
  echo "Failed"
fi

Otherwise, the repository owner hasn't updated their code in four years, so unfortunately, I don't think there will be a merge...

@sbf-
Copy link

sbf- commented Aug 21, 2025

Otherwise, the repository owner hasn't updated their code in four years, so unfortunately, I don't think there will be a merge...

This PR was created in 2022, so at that time there was a chance to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants