S
S
SHA_bash2021-03-24 19:44:09
bash
SHA_bash, 2021-03-24 19:44:09

How to extract the directory name from a variable?

Is it possible to specify the name of a directory in bash , through a variable ?
More or less like this:
605b6c40e4d4f890600562.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
CityCat4, 2021-03-24
@CityCat4

Of course. True, I would do like this: What's the difference? If you have the line "mum ate the frame masha washed rum" in your name, then in your version the command cd /Volumes/mum will be executed, which is hardly what was intended :)
cd "/Volumes/$name"

S
Saboteur, 2021-03-25
@saboteur_kiev

1. why not try before asking a question? It would take much less time than asking a question.
2. yes, you can.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question