Skip to content
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

Made the code more readable, Fixed code and typo #574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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.

1 participant