Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ./!$ mean in Linux?

Tags:

A noobie Linux learner here.

I created a python script and chmod 700 filename.py, when I was going to using ./filename.py, my instructor came and use ./!$ to run the file.

What does the ./!$ that actually mean? I couldn't google it out. I'd greatly appreciate for a link of cheatsheet for the similar commend too.

Thanks in advance.

like image 217
Meruemu Avatar asked Jul 21 '16 23:07

Meruemu


1 Answers

Suppose I just ran a command python test.py. This was my last command I entered into the shell. However, its argument was test.py.

Remembering that ./ refers to the current working directory, when I type ./!$ I get the following output:

$ ./!$
./test.py
./test.py: line 1: import: command not found
./test.py: line 2: $'\r': command not found
./test.py: line 3: syntax error near unexpected token `('
'/test.py: line 3: `df = pd.DataFrame([

By context clues my last argument was used as the !$.

If I enter several arguments such as python test.py test2.py I get:

$ ./!$
./test2.py
./test2.py: line 1: import: command not found
Unable to initialize device PRN

Confirming my intuition.

like image 140
Jossie Calderon Avatar answered Sep 28 '22 01:09

Jossie Calderon