Check how a script was started

TMH

I'm making myself a few "helper" scripts, and the first one is to install NodeJS. The first issue I've just solved, was getting source ~/.profile to persist changes. I found out running . /scripts/install-nodejs.sh makes this work, but without the leading ., it doesn't.

Is there anyway I can tell in the script if it was called with the period before it, so if it isn't I can output myself a message remind me how to call the script properly?

For reference, this is the script so far

#!/bin/bash

echo -n "Installing NVM..."
apt-get -qq install curl > /dev/null
curl -s https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh > /dev/null
echo "Done!"
source ~/.profile

Also, side question, is there a way to describe when a script is called with a preceding period?

cripp

The . is short hand for sourcing the script. Sourcing a script is like calling each of the commands by hand.

Check this out The Dot

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to check if a WildFly Server has started successfully using command/script?

Powershell script to check if service is started, if not then start it

How to check if game was started once

How to end a cron started script?

Check if script is started by cron, rather than invoked manually

Powershell script to check services - start services - return status that it is started

How to check if application has started inside container

Python how to check if a thread has already started

How to check that Zookeeper server is started using Curator?

How to check if a process started in the background still running?

How to check if python unit test started in PyCharm or not?

How to check if webview YouTube video player was started

how to check if a user started a bot in telegram or not?

How to check inside Ktor that the Netty is actually started?

How to check whether tomcat server is started up

Android VpnService - How to check VpnService if it was started?

How to check if a new process started in windows?

How many threads will be started with shell script wait

How to get started with testing on an existing python script?

How to test what started a powershell script

How to get `pwd` in the shell script that was started by another shell script

How to check if script is running or not from script itself?

How to check dependency in bash script

How to check if npm script exists?

How to check response of Pac script

How to check regex in bash script

How to check if a filesystem is mounted with a script

How to check the file type in a script

How to check if new day has started in other timezone in php