Questions tagged [source-command]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
212 views

Can a bash script add to the context of zsh?

I have recently migrated from bash to zsh. I used to use the following token_refresh.sh script to ssh-add my private key to the session: #!/usr/bin/env bash echo "configuring ssh access.." ...
StuperUser's user avatar
1 vote
1 answer
24k views

/bin/ksh: bad interpreter: No such file or directory [duplicate]

I have script with #!/bin/ksh in the first line. When I try to execute this script (run ./myscript.sh) the error occurred: -bash: ./myscript.sh: /bin/ksh: bad interpreter: No such file or directory ...
Nik's user avatar
  • 13
1 vote
2 answers
222 views

Why does the command 'source' have that name?

I wonder why a command that executes commands from a file in the current shell is named source. I can't see a relation between run commands in the current shell and the meaning of the english word ...
rrd's user avatar
  • 145
15 votes
4 answers
20k views

How can I skip the rest of a script without exiting the invoking shell, when sourcing the script?

I have a bash script, where I call exit somewhere to skip the rest of the script when getopts doesn't recognize an option or doesn't find an expected option argument. while getopts ":t:" opt; do ...
Tim's user avatar
  • 102k
6 votes
3 answers
3k views

Parameters passed to a sourced script are wrong

A script on AIX which checks the number of parameters passed and complains if they are not correct:- if [ "$#" -ge 1 ]; then ... else echo 'Usage: myscript <a> [b] [c]' fi The script sets ...
Morag Hughson's user avatar
1 vote
2 answers
942 views

How to decrypt the file on the fly without process substitution?

I need to source the file by decrypting it on the fly using the below command. . <(gpg -qd "$encrypted_filename") sh is not supporting process substitution. I can't use bash. Please suggest some ...
aravindderajan's user avatar