Skip to content

Use . instead of source in shell scripts #97

Closed
@gucharbon

Description

@gucharbon

I'm using 18.04.3 LTS (Bionic Beaver) and python 3.7.5
I just created my own repository using cookiecutter.

I ran the script ./scripts/build-push.sh and received the error below:

(venv) [email protected]:/c/Users/monsoon/fastapi/webdemo(21:19:57)$ ./scripts/build-push.sh
./scripts/build-push.sh: 6: ./scripts/build-push.sh: source: not found

After taking a look at the template I saw that /bin/sh is specified in shebang:

#! /usr/bin/env sh

# Exit in case of error
set -e

Ubuntu uses /bin/dash in place of/bin/sh and not /bin/bash. Ubuntu Wiki states that:

The source builtin is a bashism (related checkbashisms warning text: 'source' instead of '.'). Write this simply as . instead.

Isn't there anybody on Ubuntu or Debian which tried to run the scripts and had this error? I searched existing issue but found none.

Edit: I just saw in the README that user should use bash to start scripts (as in the example: TAG=prod FRONTEND_ENV=production bash ./scripts/build-push.sh) but I still feel that this . should be used instead of source to be coherent with shebang and to allow usage of TAG=prod FRONTEND_ENV=production ./scripts/build-push.sh.

Anyway thanks for the awesome work :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions