Questions tagged [alias]

An alias is an alternative name. In computer science, the most common contexts are command aliases in shells, column aliases in databases, or variable references in languages like C++.

For bash aliases use the tag.

4406 questions
7486
votes
66 answers

What is the difference between String and string in C#?

What are the differences between these two, and which one should I use? string s = "Hello world!"; String s = "Hello world!";
Lance Fisher
  • 25,684
  • 22
  • 96
  • 122
1773
votes
25 answers

Make a Bash alias that takes a parameter?

I used to use CShell (csh), which lets you make an alias that takes a parameter. The notation was something like alias junk="mv \\!* ~/.Trash" In Bash, this does not seem to work. Given that Bash has a multitude of useful features, I would assume…
Hello
  • 17,827
  • 3
  • 16
  • 6
612
votes
24 answers

List Git aliases

How do I print a list of my git aliases, i.e., something analogous to the bash alias command?
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
519
votes
20 answers

Aliases in Windows command prompt

I have added notepad++.exe to my Path in environment variables. Now in command prompt, notepad++.exe filename.txt opens the filename.txt. But I want to do just np filename.txt to open the file. I tried using DOSKEY np=notepad++. But it is just…
Romonov
  • 8,145
  • 14
  • 43
  • 55
369
votes
7 answers

Should I use alias or alias_method?

I found a blog post on alias vs. alias_method. As shown in the example given in that blog post, I simply want to alias a method to another within the same class. Which should I use? I always see alias used, but someone told me alias_method is…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
338
votes
7 answers

Git alias with positional parameters

Basically I'm trying to alias: git files 9fa3 ...to execute the command: git diff --name-status 9fa3^ 9fa3 but git doesn't appear to pass positional parameters to the alias command. I have tried: [alias] files = "!git diff --name-status $1^…
user400575
  • 3,555
  • 2
  • 17
  • 11
325
votes
11 answers

How to pass command line arguments to a shell alias?

How do I pass the command line arguments to an alias? Here is a sample: alias mkcd='mkdir $1; cd $1;' But in this case the $xx is getting translated at the alias creating time and not at runtime. I have, however, created a workaround using a…
Vini
  • 8,299
  • 11
  • 37
  • 49
287
votes
20 answers

In Bash, how to add "Are you sure [Y/n]" to any command or alias?

In this particular case, I'd like to add a confirm in Bash for Are you sure? [Y/n] for Mercurial's hg push ssh://username@www.example.com//somepath/morepath, which is actually an alias. Is there a standard command that can be added to the alias…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
285
votes
13 answers

How do I run a shell script without using "sh" or "bash" commands?

I have a shell script which I want to run without using the "sh" or "bash" commands. For example: Instead of: sh script.sh I want to use: script.sh How can I do this? P.S. (i) I don't use shell script much and I tried reading about aliases, but I…
Rameez Hussain
  • 6,414
  • 10
  • 56
  • 85
283
votes
2 answers

How to write UPDATE SQL with Table alias in SQL Server 2008?

I have a very basic UPDATE SQL - UPDATE HOLD_TABLE Q SET Q.TITLE = 'TEST' WHERE Q.ID = 101; This query runs fine in Oracle, Derby, MySQL - but it fails in SQL server 2008 with following error: "Msg 102, Level 15, State 1, Line 1 Incorrect…
javauser71
  • 4,979
  • 10
  • 27
  • 29
245
votes
12 answers

Git Alias - Multiple Commands and Parameters

I am trying to create an alias that uses both multiple Git commands and positional parameters. There are Stackoverflow pages for each, and it would appear painfully obvious to do both, but I am having trouble. As an example, I want to switch to…
Stella
  • 2,453
  • 2
  • 14
  • 5
243
votes
5 answers

What do the &,<<, * mean in this database.yml file?

Up until now I have only used database.yml with each parameter called out explicitly, in the file below it uses some characters I do not understand. What does each line and symbol(&, *, <<) mean? How do I read this file? development: &default …
OpenCoderX
  • 6,180
  • 7
  • 34
  • 61
199
votes
10 answers

SQL - using alias in Group By

Just curious about SQL syntax. So if I have SELECT itemName as ItemName, substring(itemName, 1,1) as FirstLetter, Count(itemName) FROM table1 GROUP BY itemName, FirstLetter This would be incorrect because GROUP BY itemName, FirstLetter…
Haoest
  • 13,610
  • 29
  • 89
  • 105
191
votes
6 answers

ZSH alias with parameter

I am trying to make an alias with parameter for my simple git add/commit/push. I've seen that a function could be used as an alias, so I tried but I didn't make it. Before I had: alias gitall="git add . ; git commit -m 'update' ; git push" But I…
albttx
  • 3,444
  • 4
  • 23
  • 42
189
votes
6 answers

Can you define aliases for imported modules in Python?

In Python, is it possible to define an alias for an imported module? For instance: import a_ridiculously_long_module_name ...so that is has an alias of 'short_name'.
Jordan Parmer
  • 36,042
  • 30
  • 97
  • 119
1
2 3
99 100