H
H
hckn2019-01-05 15:18:47
linux
hckn, 2019-01-05 15:18:47

Why doesn't path through variable work?

Works

#!/bin/bash

mkdir /home/vasya/Backup/data

Does not work
#!/bin/bash

$dir=/home/$USER/Backup/data
mkdir $dir

Why and how to fix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2019-01-05
@hckn

$dir=/home/$USER/Backup/data
change to
Or even easier

#!/bin/bash
mkdir /home/$USER/Backup/data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question