Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Help understanding how to create this alias - inserting variables and arguments
Post Body

Hello everyone,

I have got a couple friends to try out OTW's Bandit to get some hands-on with Linux. I wanted to come up with a system for connecting to each level. Initially, I was just creating a variable $LVL and redefining it to a new number every time I exit the ssh connection and move on to the next part.

However, after recently starting to create my own command aliases, I wanted to try that. The idea is so that I can just say banditssh levelnumber

I need to still learn more bash scripting fundamentals. I have one alias I copied from a video:

alias pf="ps -e | grep $1"

(Where $1 is the first argument given) - when I saw this, I was so excited. I wanted to try and use that method of writing arguments in my next commands.

I tried this (naively):

alias banditssh="ssh [email protected] -p 2220"

So yeah, I realized it gets read as a (blank) variable instead of an argument when I try banditssh 2

What would my solution be here? I feel like I'm being stupid and missing something simple. Is the only way to keep redefining the variable and then calling ssh from history again? It's not too troublesome, but I just want to learn.

Author
Account Strength
80%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
212
Link Karma
29
Comment Karma
183
Profile updated: 22 hours ago
Posts updated: 9 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
5 years ago