P
P
Pinkman2020-03-04 15:13:37
linux
Pinkman, 2020-03-04 15:13:37

How to embed variables in sh script?

All the best! There is this script:

cat /etc/passwd | grep -v ‘^*#’ | awk -F\\: ‘{print $1}’ | sed -n $FT_LINE1,$FT_LINE2p | rev | sort -r | tr ‘\n’ ‘,’

It is necessary to make so that I myself could select the lines. But I can’t insert variables into sed, I tried to write in different ways (both quotes and brackets) it doesn’t work.
How to insert variables instead of numbers here??
sed -n 1,5p

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2020-03-04
@famousman204

To refer to variables, use the following syntax:
${FT_LINE1}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question