Questions tagged [set]
57 questions
96
votes
2 answers
What does "set --" do in this Dockerfile entrypoint?
I'm trying to understand what this Docker entrypoint does.
It seems to me that's a very common pattern when writing Dockerfiles, but my bash skills are limited and I have no idea of all the special bash symbols kung fu.
Also, it's hard to google…
Lucas Pottersky
- 1,063
- 1
- 8
- 6
79
votes
5 answers
How to export variables that are set, all at once?
set command displays all the local variables like below. How do I export these variables all at once?
>set
a=123
b="asd asd"
c="hello world"
Neerav
- 2,915
- 3
- 15
- 7
36
votes
4 answers
What is the meaning of "_="?
After I run the set -a var=99, I can find a sentence in the output of set:
...
TERM=xterm
UID=0
USER=root
VIRTUAL_ENV_DISABLE_PROMPT=1
_=var=99
colors=/etc/DIR_COLORS
...
Could anyone tell me what "_=" means?
I note that echo $var will give…
yode
- 1,037
- 4
- 11
- 19
30
votes
5 answers
What does set command without arguments do?
What does set command without arguments do?
As I can see it prints out my environment variables just like env command but in alphabetical order. And further it prints some different information (variables? functions?)…
Aleksandr Kovalev
- 403
- 1
- 4
- 7
18
votes
2 answers
Suppress the bash execution trace (set -x) from the outside of the script
I tried finding an answer to this question, but got no luck so far:
I have a script that runs some other scripts, and many of those other scripts have "set -x" in them, which makes them print every command they execute. I would like to get rid of…
human
- 303
- 2
- 7
17
votes
2 answers
What is "( set -o posix ; set ) | less " doing?
On my search for a command to list all shell variables, I somehow realized, that there is a command to list all environment variables, but somehow there is no one to list all shell variables, for reasons unknown to me.
However, someone here gave an…
sharkant
- 3,560
- 10
- 30
- 46
9
votes
4 answers
Can I unset the $1 variable?
Is it possible to unset the $1 variable? If not, I can't find out where it is explained in man.
[root@centos2 ~]# set bon jour
[root@centos2 ~]# echo $1$2
bonjour
[root@centos2 ~]# unset $1
[root@centos2 ~]# echo $1$2
bonjour
[root@centos2…
Pozinux
- 1,305
- 5
- 16
- 27
8
votes
1 answer
What is the parameter "i" of the set command in the bash shell?
I looked up the shell builtin command set by typing help set, and the short syntax description shows:
set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
The help-documentation explains, that the variable $- holds all current parameters set…
sharkant
- 3,560
- 10
- 30
- 46
8
votes
4 answers
How to remove the functions displayed by set command?
When set command is used without any options, it displays the names and values of all shell variables and functions.
We want to display only the variables and avoid the functions from the output.
frp farhan
- 207
- 2
- 11
7
votes
2 answers
What is `set -o keyword` doing on bash?
What function exactly is the "keyword" option assigned by the set command on bash shell?
OPTION:
set -o keyword
OR
set -k
A simple example is enough for me to understand.
testter
- 1,290
- 2
- 11
- 24
6
votes
3 answers
`set -x` debugging my `.zshrc`
When I use set -x to debug a command it output some extra lines.
% set -x
+precmd_update_git_vars:1> [ -n '' ']'
+precmd_update_git_vars:1> [ '!' -n '' ']'
+precmd_update_git_vars:2> update_current_git_vars
+update_current_git_vars:1> unset…
Ahmad Ismail
- 2,478
- 1
- 22
- 47
6
votes
2 answers
What does "set -f" in Korn Shell do?
In the book "A guide to aix 3.2", it says that one may use the Korn Shell command set -f to "disable filename generation", but what does it mean?
What happens with set -f?
elbarna
- 12,050
- 22
- 92
- 170
5
votes
2 answers
Redirect a portion of a bash script to a file to capture set -x output
I have a bash script and I want to capture a portion of the script with a set -x and redirect that output to a file.
I can see what the ENVFILE is setting but its going to std out.
Is there a way I can capture the output of the set -x into a file…
Shar Hunter
- 147
- 1
- 1
- 3
4
votes
1 answer
Bash Shell “noexec” Option Usage Purpose
-n noexec ; Read commands and check syntax but do not execute them.
Can you give an example of when we will need "noexec" which is one of the Bash options?
Can someone give me an example of how to properly use this option?
testter
- 1,290
- 2
- 11
- 24
4
votes
1 answer
Formatting display of of `set -v` output
From the description of set in the bash man page:
-v Print shell input lines as they are read.
Thus, the following example script:
#!/usr/bin/env bash
# setv.sh
set -v
foo=bar
echo $foo
Generates output:
foo=bar
echo $foo
bar
Is there a way for…
mbigras
- 2,928
- 6
- 28
- 45