Bash_alias


#1

I don’t understand what I’m doing wrong or if its wrong


#2

From alias's perspective it is invoked like this by you:

['alias', 'hy', '=', 'history']

(first argument being the program name, then the arguments)

alias expects alias definitions to be a single argument, like so:

['alias', 'hy=history']

You provided three, none of which were aliases or alias definitions.
Compare what you wrote to the example.


#3

Hey, thanks.
So I use to many spaces? :slight_smile:


#4

It’s entirely allowed to have spaces, so I wouldn’t say too many spaces

You’re sending text to alias, and that text needs to match what patterns it is programmed to handle.

If you run one of these:

alias --help
help alias
man alias
info alias

(which one causes alias to print help depends a bit on what exactly alias is and how it’s been installed and whether manpages/infopages are set up…)

It’ll tell you that this pattern is:

alias [alias-name[=string]...]

Where the brackets means optional and … means one or more occurrences

So the program name, and then each argument is either an alias name, or an alias name immediately followed by = followed by any text


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.