Giter Site home page Giter Site logo

POSIX compilant in bin/pull.sh about dotfiles HOT 5 OPEN

advy99 avatar advy99 commented on July 29, 2024
POSIX compilant in bin/pull.sh

from dotfiles.

Comments (5)

Alexmnzlms avatar Alexmnzlms commented on July 29, 2024 1

Let me have a look

from dotfiles.

advy99 avatar advy99 commented on July 29, 2024

Fixed in #6

from dotfiles.

advy99 avatar advy99 commented on July 29, 2024

I just noticed deploy.sh have the same error

if [[ $line == \~/* ]]; then

Should be easy to fix, like in #6

from dotfiles.

Groctel avatar Groctel commented on July 29, 2024

dotfiles/bin/deploy.sh

Lines 32 to 37 in ce9f385

if [ -f $line ] || [ -d $line ]; then
diff -r $line ../$local_line > /dev/null
else
printf "$line does not exists in the system\n"
cat $line 2> /dev/null
fi

I see here that you're checking here if your file has was modified since the last time it was updated in the repository.
Then you use this:

dotfiles/bin/deploy.sh

Lines 39 to 41 in ce9f385

if [ $? -eq 0 ]; then
printf "\t $line didn't changed since last deploy. Omitting.\n"
else

What's your purpose with those lines? I'm tring to remove the $? and just if the command you're using to check the files, but I don't understand this workflow.

from dotfiles.

advy99 avatar advy99 commented on July 29, 2024

The exit status of diff is:

  • 0 if inputs are the same
  • 1 if different
  • 2 if trouble

So:

  • If we find the file (or directory) we check if some differences are found
  • If the file does not exists, display a message

But printf have 0 as exit code, and the it would be interpreted as the file existed but didn't changed, so I launch cat to a non existing file and send the error message to /dev/null, but the exit code is different from 0 as the file does not exist

from dotfiles.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.