C
C
CreativeStory2019-01-17 09:42:21
linux
CreativeStory, 2019-01-17 09:42:21

What is the correct way to use variables in the terminal?

Good afternoon!
How to write a command so that when creating an arbitrary folder, the next step is to go to it?
what to fix in this code?
mkdir {$s} && cd {$s}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sudo rm -rf /, 2019-01-17
@CreativeStory

In .bashrc

mkcd() {
    mkdir $1
    cd $1
}

Then in the console you can write like this
~> mkcd foobar
~/foobar>

Example
_48cdb181b0272f06432995574bb386df.gif?no

B
bova, 2019-01-17
@bova8

mkdir "foo" && cd "$_"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question