Skip to main content

Questions tagged [variable]

A variable is a name, if correctly chosen with a symbolic meaning, that holds a value or values. Use this tag if your question is specific on the use of variables on shell scripting (if you want to ask about variables in programming languages you should probably ask on StackOverflow)

0 votes
1 answer
58 views

What do I want : On the file manager lf, we can bind some keyboard shortcuts to do either a lf command with :, or a shell command with $, !, or other symbols. According to the documentation, there is ...
ewen-goisot's user avatar
0 votes
1 answer
63 views

Can anyone explain what's going on with DR here? user@host:~# DRYRUN=true user@host:~# echo "$DRYRUN" true user@host:~# $DRYRUN && export DR="-n" user@host:~# echo $DR user@...
Hugh's user avatar
  • 19
0 votes
0 answers
38 views

I have a script which is supposed to fetch 2 URLs sequentially: #!/bin/bash wget_command='wget --restrict-file-names=unix https://www.example.com/{path1,path2}/' $($wget_command) echo $wget_command ...
MonkeyZeus's user avatar
0 votes
2 answers
189 views

This code my_file="/tmp/file_without_spaces" if [ -f "${my_file}" ]; then my_ls_aaaammgg_hhss="$(ls ${my_file} -l --time-style='+%Y%m%d_%H%M%S' | cut -d' ' -f6)" mv &...
CarLaTeX's user avatar
  • 331
-1 votes
2 answers
106 views

whats wrong with this bash script: acme2=$(dig txt @$1 _acme-challenge.$1.de) acme3=$(echo $acme2 | grep "^_acme") ...
dg1kpc's user avatar
  • 1
-3 votes
1 answer
88 views

In the Bash manual, it is written about the tilde expansion: Each variable assignment is checked for unquoted tilde-prefixes immediately following a ‘:’ or the first ‘=’. Read the Bash manual about ...
Kiki Miki's user avatar
1 vote
3 answers
146 views

In Bash for macOS, I need to be able to pass a string to a function and return the value of a variable named after that string, as well as the string itself. Here's what I have so far, which doesn't ...
seagull's user avatar
  • 111
1 vote
1 answer
90 views

General overview I have to set a values auto-completion in zsh for a command (in the following minimal example, I will show it with testcmd). So my current code work quiet well with hardcoded values: ...
fauve's user avatar
  • 1,529
1 vote
1 answer
60 views

I need to assign a command to a variable and execute it with variable in linux bash. The command executes fine from command line but not from the variable because of multiple quotes. I hope backslash ...
Kishan's user avatar
  • 113
5 votes
4 answers
623 views

I would like to execute a script on a host machine (script_on_host.sh), which then reaches inside a docker container in order to grab some data using a second script (script_in_container.sh). The data ...
teeeeee's user avatar
  • 305
3 votes
1 answer
210 views

I am configuring my hyprland.conf file and I am attempting to do it in a clean and modular fashion. I am trying for a modular fashion so that I can share my dotfiles and someone else can change which ...
PrismaPixel Studios's user avatar
-1 votes
1 answer
159 views

I am trying to set a local variable in a function with nameref. The script code is the following: #!/usr/bin/bash msg=hello myparam='' superfunc () { productfile=$1 local -n refmyparam=$2 } ...
trikelef's user avatar
  • 470
1 vote
1 answer
93 views

In this test I'm expecting it to print "var1 is 999". user@penguin:~$ for num in {1..3}; do export var$num=9999 ; echo var$num is $var$num ; done var1 is 1 var2 is 2 var3 is 3 user@penguin:~...
Dan Larrabee's user avatar
2 votes
2 answers
526 views

I looked through some of the posted threads and none of them cover my query. I have a simple line of code below which prints all the ASCII characters: echo {' '..'~'} I want to be able to use a ...
James Bond's user avatar
0 votes
3 answers
413 views

I have a json object that has an unknown number of variables, like this: { "var1": 123, "var2": 456, "var3": 789 } How can I automatically convert it to form ...
teeeeee's user avatar
  • 305

15 30 50 per page
1
2 3 4 5
83