Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
2
votes
1
answers
200
views
How to get multiple pattern rule %/$* variables in a Makefile?
All we get in Makefiles is just one `%/$*` [pattern rule](https://www.gnu.org/software/make/manual/html_node/Pattern-Rules.html#Pattern-Rules) pair. ``` $ cat Makefile %.bla:; echo $* $ make -s m.bla m ``` How shortsighted of our Unix™ fathers. How can I achieve something like `%{0}.%{1}.bla`...
All we get in Makefiles is just one
How can I achieve something like
%/$*
[pattern rule](https://www.gnu.org/software/make/manual/html_node/Pattern-Rules.html#Pattern-Rules) pair.
$ cat Makefile
%.bla:; echo $*
$ make -s m.bla
m
How shortsighted of our Unix™ fathers.How can I achieve something like
%{0}.%{1}.bla
that will give me
$ make -s a.b.bla
a b
Sure, one could use $(basename)
, $(suffix)
, $(subst)
,
but I'm talking about two actual independent $*
-like variables.
Dan Jacobson
(560 rep)
Jun 30, 2025, 08:13 AM
• Last activity: Jul 1, 2025, 08:19 PM
1
votes
2
answers
2643
views
Replace command in Bash script from another script
I'm trying to setup a script that will fetch changes from github where a script has a command that's not executable in Mac OS X. What I'm aiming for is to use `sed` etc to replace the command within that script. These are the commands: Original command (to be replaced in script): DIR=$(dirname "$(re...
I'm trying to setup a script that will fetch changes from github where a script has a command that's not executable in Mac OS X.
What I'm aiming for is to use
sed
etc to replace the command within that script.
These are the commands:
Original command (to be replaced in script):
DIR=$(dirname "$(readlink -f $0)")
New command (I want to replace with):
DIR="$(cd "$(dirname "$0")" && pwd -P)"
What I've tried so far:
StartStopScript="/path/to/script.sh"
DIRnew=""$(cd "$(dirname "$0")" && pwd -P)""
DIRold=""$(dirname "$(readlink -f $0)")""
echo "$StartStopScript" | sed -e 's/"$DIRold"/"$DIRnew"/g'
This fails and the commands seems to be executed instead of interpreted as a string.
Figure it comes down to quoting in sed
.
Grateful for any help I can get with this.
Björn Dalberg
(11 rep)
Aug 14, 2015, 10:31 AM
• Last activity: May 23, 2025, 04:04 PM
0
votes
0
answers
43
views
bash variable substitution inside heredoc delimiter: how does it work?
For a school project, I am tasked with making my own (simplified) shell, with bash being the reference point. This includes replicating heredoc behavior which was fun until I stumbled upon variable substitution INSIDE of the delimiter, as such: ```export TESTVAR=hello``` followed by cat hello > $TES...
For a school project, I am tasked with making my own (simplified) shell, with bash being the reference point. This includes replicating heredoc behavior which was fun until I stumbled upon variable substitution INSIDE of the delimiter, as such:
TESTVAR=hello
followed by
cat hello
> $TESTVAR
hello
As demonstrated here, typing the value of the variable manually does not end the heredoc, whereas typing $TESTVAR
does. Does this mean that variables are not substituted if they're inside of the delimiter?
Disabling variable substitution results in the same thing:
cat hello
> $TESTVAR
hello
And getting wild with the quotes also results in the same thing:
cat hello
> TVAR
> $TESTVAR
hello
TVAR
All evidence seems to point towards $TESTVAR
does not get substituted **because** it is part of a heredoc delimiter, but I can't find a definitive answer to this! Does anyone know?
Mika
(101 rep)
May 9, 2025, 01:58 PM
• Last activity: May 9, 2025, 02:17 PM
6
votes
4
answers
824
views
Using curly braces to process colon-separated variables
If we do: VAR=100:200:300:400 We can do: echo ${VAR%%:*} 100 and echo ${VAR##*:} 400 Are there any equivalents I could use to get the values of 200 and 300? For instance, a way to get only what's between the second and third colon specifically in case there are more than just 3 colons?
If we do:
VAR=100:200:300:400
We can do:
echo ${VAR%%:*}
100
and
echo ${VAR##*:}
400
Are there any equivalents I could use to get the values of 200 and 300?
For instance, a way to get only what's between the second and third colon specifically in case there are more than just 3 colons?
Cestarian
(2438 rep)
Apr 26, 2025, 03:54 AM
• Last activity: Apr 26, 2025, 10:52 PM
0
votes
0
answers
20
views
Shell expension in variable allocation containing the char '*'
For the shell fans (bash) : I want a variable to get a value resulting from an operation output which contains an globbing character (such as `*`), and the shell expansion always happens, even if I quote or doublequote the expression. To reduce the problem scope, all the three following commands ret...
For the shell fans (bash) :
I want a variable to get a value resulting from an operation output which contains an globbing character (such as
*
), and the shell expansion always happens, even if I quote or doublequote the expression.
To reduce the problem scope, all the three following commands return the current directory file list (which is quite strange for me, as I never met this issue before after 30 years of shell practice !!! Still time to learn) :
-bash
var=*; echo ${var}
var="*"; echo ${var}
var='*'; echo ${var}
but I would like the last command to print simply the *
character.
I've searched thru the shopt
options but didn't find any one to solve the issue.
Has anyone an idea?
misterpc
(1 rep)
Apr 9, 2025, 01:33 PM
• Last activity: Apr 9, 2025, 01:36 PM
0
votes
1
answers
57
views
Variable substituion ":+" in automake
- On ubuntu 24.04 - GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu) - automake (GNU automake) 1.16.5 - autoconf (GNU Autoconf) 2.71 From [automake doc](https://www.gnu.org/software/autoconf/manual/autoconf-2.71/autoconf.pdf) >${var:+value} Old BSD shells, including the Ultrix sh, don’t acc...
- On ubuntu 24.04
- GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
- automake (GNU automake) 1.16.5
- autoconf (GNU Autoconf) 2.71
From [automake doc](https://www.gnu.org/software/autoconf/manual/autoconf-2.71/autoconf.pdf)
>${var:+value}
Old BSD shells, including the Ultrix sh, don’t accept the colon for any shell substitution, and complain and die. Similarly for ${var:=value}, ${var:?value},
etc. However, all shells that support functions allow the use of colon in shell
substitution, and since m4sh requires functions, you can portably use null variable substitution patterns in configure scripts.
The substituion does not happen in the following
example
Given : SOURCE_DATE_EPOCH = 333
src/Makefile.am
bin_PROGRAMS = myproject
myproject_SOURCES = main.c
param6=123
a=${param6:+xyz}
$(info ####### a = $(a)#######)
$(info ####### $(SOURCE_DATE_EPOCH) #######)
$(info ########## ${SOURCE_DATE_EPOCH:+ -d @${SOURCE_DATE_EPOCH}})
output :
####### a = #######
####### 333 #######
##########
The third info log isn't printing SOURCE_DATE_EPOCH value despite it being defined
Is it possible to use variable substitution like ":+" in automake files ?
maths soso
(3 rep)
Mar 27, 2025, 05:34 AM
• Last activity: Mar 31, 2025, 02:46 PM
0
votes
2
answers
104
views
zsh: substitute-if-undef-or-null for $1, $2 …: ${1:substitution} doesn't work
I'd like to have standard parameters, i.e., my minimum reproducible example is: ```shell #!/usr/bin/zsh a=${1:a} printf 'a: "%s"\n' "${a}" b=${2:./build} printf 'b: "%s"\n' "${b}" ``` I'd expect to see, when running `./demo.zsh` without arguments: ```text a: "a" b: "./build" ``` Instead I get ```tex...
I'd like to have standard parameters, i.e., my minimum reproducible example is:
#!/usr/bin/zsh
a=${1:a}
printf 'a: "%s"\n' "${a}"
b=${2:./build}
printf 'b: "%s"\n' "${b}"
I'd expect to see, when running ./demo.zsh
without arguments:
a: "a"
b: "./build"
Instead I get
a: ""
./demo.zsh:4: bad floating point constant
- why does ${1:a}
seem to assume $1
to be set and non-zero, but the $a
expanded is empty string?
- where does the floating point misparsing come from? If I replace ./build
with build
, it complains about b
being an unknown modifier.
If I run ./demo.zsh asdf bar
, I get
a: "/tmp/fasf"
./demo.zsh:4: bad floating point constant
which, frankly is even more confusing; where does /tmp/
come from (it's the cwd).
Marcus Müller
(47107 rep)
Mar 10, 2025, 10:39 AM
• Last activity: Mar 10, 2025, 05:12 PM
0
votes
4
answers
453
views
If-else Parameter substitution
I'm running a series of experiments with bash and want to store the log files in a directory whose name is based on the experiment configuration. Some items in the configuration are boolean (true/false). Take the following configuration as an example: ``` batch_size=16 fp16=false bf16=true checkpoin...
I'm running a series of experiments with bash and want to store the log files in a directory whose name is based on the experiment configuration. Some items in the configuration are boolean (true/false). Take the following configuration as an example:
batch_size=16
fp16=false
bf16=true
checkpoint_activations=true
I'd like to store the log file from the experiment with above configuration as input in a directory with the following name:
output_dir="experiment_bs${batch_size}_dt${fp16 if fp16=true else bf16}_${cp if checkpoint_activations=true else empty}"
Of course, I could declare helper variables:
data_type=""
"${fp16}" && data_type=fp16
"${bf16}" && data_type=bf16
"${cp}" && cp="_cp" || cp=""
output_dir="experiment_bs${batch_size}_dt${data_type}${cp}"
But I find this somewhat clunky and hope that [parameter substitutions](https://tldp.org/LDP/abs/html/parameter-substitution.html#PARAMSUBREF) could be useful here. "${bf16:+bf16}"
won't help in my case because this will always print "bf16" regardless of its boolean value as long as it's defined.
Are there any parameter substitutions that could be applied to this use-case? Or is there an even better in-line solution to this problem?
Note: there's an application-specific reason why I don't directly use data_type
in my configuration.
Green 绿色
(331 rep)
Feb 6, 2024, 01:36 AM
• Last activity: Jan 24, 2025, 08:25 PM
1
votes
1
answers
47
views
How To Use Quotes In Variable In Bash
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 should be used for multiple quotes to avoid the error. Please help with the correct format. **Code:*...
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 should be used for multiple quotes to avoid the error. Please help with the correct format.
**Code:**
parm="cat file|awk '$1>0 && $1="abc" {print f $0} {f=$0 ORS}'"
eval "$parm"
**Contents:**
abc
123
efg
456
**Error:**
awk: cmd. line:1: >0 && =abc {print f bash} {f=bash ORS}
awk: cmd. line:1: ^ syntax error
Thanks in advance!
Kishan
(113 rep)
Jan 16, 2025, 05:05 AM
• Last activity: Jan 16, 2025, 08:05 AM
1
votes
6
answers
288
views
Move a lot of folders with spaces in the name
I have a lot of webpages saved in my Download folder and I want to move all html files together with its folder (for every "NAME.html" exists "NAME_files/" folder). The big problem I can't deal is with the space in the name. I thinkered around this and after some attempts I did this: ``` export OLDI...
I have a lot of webpages saved in my Download folder and I want to move all html files together with its folder (for every "NAME.html" exists "NAME_files/" folder).
The big problem I can't deal is with the space in the name.
I thinkered around this and after some attempts I did this:
When I do my command only the html file go in 000 folder, but not the folder!
Yes, I know, the name, "[FreeFileSync] SyncSettings-Contabilità ⚠️.html" is a very **bad** name... 😅
I tried also with less exotic names with same results.
Please help me, where is my mistake?
export OLDIFS="$IFS"
export IFS=$'\n'
then:
for FILE in $(find . -type d -iname "*_files" ) ; do DIR=$(basename ${FILE/_files/}); WEB="${DIR}.html" ; mv "${DIR}" 000 ; mv "${WEB}" 000 ; done
I think i've quoted everything, but it doesn't works.
Or better, the command above move the html files but I receive the "No such file or directory" for the folders.
For example, I have this files :


Antonio
(193 rep)
Jan 12, 2025, 09:07 PM
• Last activity: Jan 14, 2025, 02:35 PM
0
votes
4
answers
189
views
bash - slice quoted substrings delimited by spaces into array
following example: ``` string=" 'f o o' 'f oo' 'fo o' " array=($string) echo "${array[0]}" ``` outputs: ``` 'f ``` while the expected output is: ``` 'f o o' ``` The only solution I came with is by changing the delimiter to newline (rather than space): ``` IFS=$'\n' string="'f o o' # 'f oo' # 'fo o'...
following example:
string=" 'f o o' 'f oo' 'fo o' "
array=($string)
echo "${array}"
outputs:
'f
while the expected output is:
'f o o'
The only solution I came with is by changing the delimiter to newline (rather than space):
IFS=$'\n'
string="'f o o' # 'f oo' # 'fo o' #"
array=($(echo "$string" | tr '#' '\n'))
echo "${array}"
outputs:
'f o o'
which outputs the expected result, however this requires to set a custom delimiter in string and it's will invoke a new subprocess on each call. I would like to see a better solution than this, thanks you!
**Edit:**
The above example string should be enough, but since some has asked what the file contents looks like, it's something similar to this:
'magic1' 'some text' 'another simple text' 'some t£xt'
'magic2' 'another line with simple text' 'foo bar' 'yeah another substring'
'magic3' 'so@m{e$%& te+=*&' 'another substring' 'here is the substring'
'magic4' 'why not another line !' 'yeah I like that' 'the substring yeah !!!'
Even more details (as some users requested):
there is a custom function which uses grep
to return the line from the above file by using a magic substring
.
for example my find function similar to this:
_find()
{
string="$(grep "$1" "$file")"
}
then I call it like this:
_find "magic2"
echo "$string"
which outputs:
'magic2' 'another line with simple text' 'foo bar' 'yeah another substring'
P/S: each substring is delimited by space, and each substring are quoted with single quotes. editing the _find
is not possible since it's used by other functions. please see the comments for more.
Zero
(39 rep)
Jan 5, 2025, 12:30 PM
• Last activity: Jan 7, 2025, 12:53 PM
8
votes
3
answers
4452
views
Keep matching pattern in shell parameter expansion
I can remove a pattern in a bash variable using `${variable##pattern}` (leading) or `${variable%%pattern}` (trailing). But I can't find a bash-only way to keep the pattern and throw the rest. I know there are solutions using `sed`, `awk`, or `grep`, but I want to know if there is a reasonably effici...
I can remove a pattern in a bash variable using
${variable##pattern}
(leading) or ${variable%%pattern}
(trailing).
But I can't find a bash-only way to keep the pattern and throw the rest.
I know there are solutions using sed
, awk
, or grep
, but I want to know if there is a reasonably efficient bash-only solution that I am overlooking?
PS: This isn't just an idle question. The initial problem is that I want to process files where the name contains a pattern (technically, '[A-Z]+([A-Z])-[0-9][0-9]+([0-9])'
: capital letters followed by a dash and digits) and I want to use the same pattern to list the files and extract the matching string for further processing.
xenoid
(9288 rep)
Jul 7, 2021, 12:48 PM
• Last activity: Dec 25, 2024, 05:18 PM
0
votes
1
answers
113
views
Is there a tool that can print out a bash script with the variables substituted?
Say I have a bash script that takes some environment variables and parameters and substitutes those variables in a script. Is there a tool that can show how the script with the substituted variables will look like? Take this short script for instance. echo user = $USER host = $HOSTNAME The program w...
Say I have a bash script that takes some environment variables and parameters and substitutes those variables in a script.
Is there a tool that can show how the script with the substituted variables will look like?
Take this short script for instance.
echo user = $USER host = $HOSTNAME
The program would output
echo user = vfclists host = unixse
So the script would be along the lines of
expandscript script.sh --param1=xxxx --param2=xxxx --param3=xxxx
and in addition to the environment variables filling the values of the params where they are set to the programs variables.
vfclists
(7909 rep)
Dec 2, 2024, 09:35 PM
• Last activity: Dec 3, 2024, 03:19 PM
2
votes
2
answers
375
views
Zsh Expanding Variables into Arrays or Lists
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 variable to substitute this array like below list="{' '..'~'}" and then do the following echo $(print ${li...
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 variable to substitute this array like below
list="{' '..'~'}"
and then do the following
echo $(print ${list})
To clarify what I am trying to do:
passwordLength="2"
for (( i = 0; i < $passwordLength; i++ ))
do
# concatenate random characters
samplePasswordRegex="$samplePasswordRegex{' '..'~'}"
done
echo $^samplePasswordRegex
James Bond
(29 rep)
Oct 18, 2024, 07:28 PM
• Last activity: Oct 24, 2024, 09:24 PM
0
votes
0
answers
24
views
Bash variable losing value
I recently added a variable to a script process that will be used as a replacement value via sed for an output script (not bash). This is one of many variables set within an if statement and (for reasons I cannot seem to deduce) the variable loses its value once outside of the if statement. This is...
I recently added a variable to a script process that will be used as a replacement value via sed for an output script (not bash). This is one of many variables set within an if statement and (for reasons I cannot seem to deduce) the variable loses its value once outside of the if statement. This is not occurring with any of the other variables that are set within the if statement. Code and expanded results follow.
if [ ${ModeTyp} == "P" ] ; then
PC_DB=idpacleanelig
PS2_DB=idpaprodserv2
PV_DB=idpaprodviews
PV_OUT=idpaprodviews
P_DB=idpaprod
P_DBIN=idpaprod
CERNH="CE_RunHierarchyControl_T" |
CECONTROL=CE_LegacyControlTable_RHMv5
echo "CERNH value is ${CERNH} after Default Population in if prod statement"
else
PC_DB=hfsdevsandbox
PS2_DB=hfsdevsandbox
PV_DB=idpaprodviews
PV_OUT=hfsdevsandbox
P_DB=hfsdevsandbox
P_DBIN=idpaprod
CERNH="CE_RunHierarchyControl_T" |
CECONTROL=CE_LegacyControlTable_RHMv5
GOTOLBL_1=""
GOTOLBL_3=""
echo "CERNH value is ${CERNH} after Default Population in if test statement"
fi
echo "CERNH value is ${CERNH} after Default Population"
RUN RESULTS:
+ '[' T == P ']'
+ PC_DB=hfsdevsandbox
+ PS2_DB=hfsdevsandbox
+ PV_DB=idpaprodviews
+ PV_OUT=hfsdevsandbox
+ P_DB=hfsdevsandbox
+ P_DBIN=idpaprod
+ CECONTROL=CE_LegacyControlTable_RHMv5
+ CERNH=CE_RunHierarchyControl_T
+ GOTOLBL_1=
+ GOTOLBL_3=
+ echo 'CERNH value is CE_RunHierarchyControl_T after Default Population in if test statement'
CERNH value is CE_RunHierarchyControl_T after Default Population in if test statement
+ echo 'CERNH value is after Default Population'
CERNH value is after Default Population
Raymond Meyer
(1 rep)
Oct 8, 2024, 01:36 PM
• Last activity: Oct 8, 2024, 01:38 PM
0
votes
1
answers
41
views
Does Bash have an option to diagnose "expanded to empty value" variables?
Does Bash have an option to diagnose (and optionally abort execution) "expanded to empty value" variables? Example (hypothetical): ``` $ bash -c 'echo $x' --xxx bash: line 1: variable 'x' expanded to empty value ``` Reason for the question: such an option may be useful when debugging scripts. For ex...
Does Bash have an option to diagnose (and optionally abort execution) "expanded to empty value" variables?
Example (hypothetical):
$ bash -c 'echo $x' --xxx
bash: line 1: variable 'x' expanded to empty value
Reason for the question: such an option may be useful when debugging scripts.
For example, in some script all variables are expected to expand to a non-empty values. Hence, using an option to detect (and optionally abort execution) "expanded to empty value" variables may be useful for such case.
I've already searched for this option in [set
builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html) , but have found nothing.
pmor
(665 rep)
Oct 4, 2024, 02:55 PM
• Last activity: Oct 7, 2024, 11:43 AM
72
votes
7
answers
170544
views
Escape a variable for use as content of another script
This question is *not* about how to write a properly escaped string literal. I couldn't find any related question that isn't about how to escape variables for direct consumption within a script or by other programs. My goal is to enable a script to generate other scripts. This is because the tasks i...
This question is *not* about how to write a properly escaped string literal. I couldn't find any related question that isn't about how to escape variables for direct consumption within a script or by other programs.
My goal is to enable a script to generate other scripts. This is because the tasks in the generated scripts will run anywhere from 0 to *n* times on another machine, and the data from which they are generated may change before they're run (again), so doing the operations directly, over a network will not work.
Given a known variable that may contain special characters such as single quotes, I need to write that out as a fully escaped string literal, e.g. a variable
foo
containing bar'baz
should appear in the generated script as:
qux='bar'\''baz'
which would be written by appending "qux=$foo_esc"
to the other lines of script. I did it using Perl like this:
foo_esc="'perl -pe 's/('\'')/\\1\\\\\\1\\1/g' <<<"$foo"
'"
but this seems like overkill.
I have had no success in doing it with bash alone. I have tried many variations of these:
foo_esc="'${file//\'/\'\\\'\'}'"
foo_esc="'${file//\'/'\\''}'"
but either extra slashes appear in the output (when I do echo "$foo"
), or they cause a syntax error (expecting further input if done from the shell).
Walf
(1567 rep)
Jul 18, 2017, 05:14 AM
• Last activity: Sep 12, 2024, 05:46 AM
0
votes
1
answers
67
views
Bash nested variable
I source these variables from a txt file in CentOS bash shell: ``` NAME01=dns1 HOST01=1.1.1.1 NAME02=dns2 HOST02=1.1.2.2 NAME03=dns3 HOST03=1.1.2.3 ## many more lines of similar NUM=02 ``` How can I use $HOST$NUM to give me 1.1.2.2, such as: ``` echo $HOST$NUM ```
I source these variables from a txt file in CentOS bash shell:
NAME01=dns1
HOST01=1.1.1.1
NAME02=dns2
HOST02=1.1.2.2
NAME03=dns3
HOST03=1.1.2.3
## many more lines of similar
NUM=02
How can I use $HOST$NUM to give me 1.1.2.2, such as:
echo $HOST$NUM
SmplJohn
(11 rep)
Sep 5, 2024, 06:54 AM
• Last activity: Sep 7, 2024, 08:09 PM
9
votes
1
answers
5569
views
Glob character within variable expands in bash but not zsh
I'm seeing an issue with zsh where a glob character within a variable is not expanding as I would expect. The following example does a better job of explaining it. $ echo $0 -bash $ echo $HOME/Downloads/zsh-test/* /Users/bruce/Downloads/zsh-test/file1 /Users/bruce/Downloads/zsh-test/file2 /Users/bru...
I'm seeing an issue with zsh where a glob character within a variable is not expanding as I would expect. The following example does a better job of explaining it.
$ echo $0
-bash
$ echo $HOME/Downloads/zsh-test/*
/Users/bruce/Downloads/zsh-test/file1 /Users/bruce/Downloads/zsh-test/file2 /Users/bruce/Downloads/zsh-test/file3 /Users/bruce/Downloads/zsh-test/file4
$ file=*; echo $HOME/Downloads/zsh-test/$file
/Users/bruce/Downloads/zsh-test/file1 /Users/bruce/Downloads/zsh-test/file2 /Users/bruce/Downloads/zsh-test/file3 /Users/bruce/Downloads/zsh-test/file4
Macbook% echo $0
zsh
Macbook% echo $HOME/Downloads/zsh-test/*
/Users/bruce/Downloads/zsh-test/file1 /Users/bruce/Downloads/zsh-test/file2 /Users/bruce/Downloads/zsh-test/file3 /Users/bruce/Downloads/zsh-test/file4
Macbook% file=*; echo $HOME/Downloads/zsh-test/$file
/Users/bruce/Downloads/zsh-test/*
I would have expected the last command to expand like it does in bash. Any idea what I'm doing wrong?
Bruce Johnson
(111 rep)
Aug 8, 2018, 07:38 PM
• Last activity: Aug 17, 2024, 01:25 PM
7
votes
1
answers
1647
views
printf - store formatted string output in a variable
Instead of the following printf '%s\t%s\t%s\t%s\n' 'index' 'podcast' 'website' 'YouTube' I want to store the printf output in a Results variable, how can I do this?
Instead of the following
printf '%s\t%s\t%s\t%s\n' 'index' 'podcast' 'website' 'YouTube'
I want to store the printf output in a Results variable, how can I do this?
Porcupine
(2156 rep)
May 9, 2024, 03:38 PM
• Last activity: May 10, 2024, 07:42 PM
Showing page 1 of 20 total questions