alias

How to add a script call to a linux command?

那年仲夏 提交于 2019-12-11 07:53:43
问题 I want to add in my linux system a script call to the ls command. This script should be executed each time the user execute the ls command. I tried 2 solutions but both are limited: 1) Using alias alias ls="/root/myscript.sh; ls" But this solution is limited because the user can call ls via a variable in this way var="ls" $var see this link for more details 2) Using function I create a function with the name ls : ls() { /root/myscript.sh; /bin/ls $@ } But this solution is limited because the

Creating an alias for a two word command like git log?

纵饮孤独 提交于 2019-12-11 07:50:57
问题 Sometimes I have a two word command like git log or apt-get install that I want to add a default parameter to. For example, most of the time I want to add the --abbrev-commit parameter to my git log , and the -y parameter to apt-get install . git log --abbrev-commit apt-get install --abbrev-commit However, I can't seem to create an alias that involves two word commands: $ alias 'git log'='git log --abbrev-commit' bash: alias: `git log': invalid alias name $ alias git log='git log --abbrev

How to create elasticsearch index alias that excludes specific fields

可紊 提交于 2019-12-11 07:42:16
问题 I'm using Elasticsearch's index aliases to create restricted views on a more-complete index to support a legacy search application. This works well. But I'd also like to exclude certain sensitive fields from the returned result (they contain email addresses, and we want to preclude harvesting.) Here's what I have: PUT full-index/_alias/restricted-index-alias { "_source": { "exclude": [ "field_with_email" ] }, "filter": { "term": { "indexflag": "noindex" } } } This works for queries (I don't

-bash no such file or directory, but it exists

℡╲_俬逩灬. 提交于 2019-12-11 07:39:42
问题 I've recompiled vim with the ruby flag for command-T awesomeness, and I wrote a script that will automatically do this for me on any machine I ssh into (and run the script), but an issue that I'm running into is that when I alias the newly compiled vim, bash throws a no such file or directory at me. Here's what I have: This works fine: $ alias v="~/Code/vim" But when I put this same line in my .bashrc, I get: -bash: =~/Code/vim: No such file or directory Even funnier, I put this in my .bashrc

How to alias a command with spaces? (Or a shell function) [duplicate]

强颜欢笑 提交于 2019-12-11 06:26:58
问题 This question already has answers here : Can I alias a subcommand? (shortening the output of `docker ps`) (1 answer) How to write an alias for “two” words [duplicate] (2 answers) Closed 2 years ago . All the documentation I've looked at seems to indicate that in both aliases and shell functions, the name cannot contain spaces. What I'm trying to do is make it more difficult for other admins (as root) to run a command against our Pass implementation (doc here : https://www.passwordstore.org/).

curl and file_get_contents both cannot find server by domain name set in hosts file

余生长醉 提交于 2019-12-11 06:13:35
问题 On both the PHP server and the client I have in /etc/hosts : 192.168.1.111 my-fake-domain-name.com The PHP server is that box (192.168.1.111). But when I use curl or file_get_contents to get anything from that alias ( my-fake-domain-name.com ) it always returns a 403 error. If I use the ip address, everything works fine. How do I get those programs to recognize the alias? //These do NOT work file_get_contents( "http://my-fake-domain-name.com" ); curl_setopt($ch, CURLOPT_URL, "http://my-fake

How to set an alias so that it will change directory and run a sh file

混江龙づ霸主 提交于 2019-12-11 05:34:25
问题 I want to have an alias which will do: >>>cd $MYUSR >>>bin/start.sh -t How can I set it? I use bash shell. Best Regards 回答1: What's wrong with the obvious? alias example='cd $MYUSR ; ./bin/start.sh -t' To make it permanent you can add it to ~/.bashrc 来源: https://stackoverflow.com/questions/10008648/how-to-set-an-alias-so-that-it-will-change-directory-and-run-a-sh-file

Bash script: internal function alias for longer arguments

时光怂恿深爱的人放手 提交于 2019-12-11 04:55:58
问题 Suppose I have defined an array, like this: DIR=(A B Supercalifragilistic) and I need to invoke the script as ./script A B Supercalifragilistic where the arguments are processed by internal functions func1() and func2() . Is there a way to make an alias (or anything, however it's called) S for Supercalifragilistic so that when I invoke: ./script A B S the internal functions will process/interpret S as Supercalifragilistic ? Thank you in advance. [edit] I should add that the script is invoked

How to create a Office 365 Outlook alias from .NET via API

怎甘沉沦 提交于 2019-12-11 04:39:01
问题 Is there a way to create a new alias to a email address in office 365 from a .net application / webpage? I've looked for a API, but couldn't find any. 回答1: Ok, so I found out that you can use PowerShell to add aliases to a email address. And PowerShell can be used with c# to connect to Office 365. Connect to Office 365 with .NET with PowerShell http://gsexdev.blogspot.se/2011/07/running-exchange-online-and-office-365.html Add alias to a email adress with PowerShell http://wdmsb.wordpress.com

nginx aliases and dynamic directory names

ⅰ亾dé卋堺 提交于 2019-12-11 04:26:45
问题 I have spent muy tiempo on this and I can't get a solution. I need a way to point the same url but with different root directory to the same application. I don't want to use rewrites because the root directoy name has to be processed by the application and rewrite discards it. http://www.host.com/a/ --> /var/www/html/project/ http://www.host.com/b/ --> /var/www/html/project/ http://www.host.com/c/ --> /var/www/html/project/ I've managed to configure in nginx an alias directory with a fixed