Alias that refers to another alias - cmder

I need to identify an alias command that refers to another alias command in Cmder, for example let's say i define firstAlias like:
alias firstAlias=cd blah/blah
than i create another alias that uses above alias like:
alias secondAlias=firstAlias $t another command
I have already tried these options(including above one) but no luck so far:
alias secondAlias=firstAlias $t another command
alias secondAlias=$firstAlias $t another command
alias secondAlias=`firstAlias` $t another command
alias secondAlias=%firstAlias% $t another command
alias secondAlias=/firstAlias $t another command
any idea appreciated,
Thanks in advance.

From what it seems you can't use an alias w/ in another alias. So a workaround is to merely call a .bat file or something with all the commands you want in it. Kind of a hassle, but that's what I had to do for my scenario.
I created a .bat file and set my alias to call that file. I put all the commands I cared about in that file...
status=%CMDER_ROOT%\config\status.bat

Related

How do I copy aliases in my cmder without typing them like alias

How do I copy aliases in my cmder without typing them like
$ alias e.=explorer...
in the terminal ?? for example this
https://gist.github.com/DavidMCarek/87687a81e2574df615ed8a48299a5023
I want to copy most of these entries in a file..
One method is to actually copy and paste these aliases into your actual aliases file.
You can do this by going to your cmder download location > config > user-aliases.cmd
Open your user-aliases.cmd file in an editor and paste all of the aliases you want to use. For example, I have a few aliases for git commands to speed up my workflow:
Save the file and then restart cmder. You should be able to use your aliases now. For example, here's my git status alias (gs) now in use:

How to remove an "Alias" in cmDer?

I created a test "alias" in cmDer
alias testalias = "dir * a ".
How to remove the alias I created?
If the alias isn't gone after restarting your console, it means that it got created permanent.
Removing a created alias is pretty simple, you just need to execute the following command:
alias /d [alias name]
In your case will be something like:
alias /d testalias
Also, if you didn't change the default alias that are created when you unzip the app, you can simple rely on another alias which is:
unalias [alias name]
Hope this helps
PS: if you want to see which are your available aliases, just execute alias and you will get them

SQLPlus one-line questions

I inherited some sqlplus code that no longer is valid in our Workload Automation tool. It needs to either be converted to a script and called, or a one-line command. I absolutely understand how to do the first (fairly basic). But if I wanted to convert to one line, is my thinking correct?
sqlplus -s myID/pwd <<EOF
define start_date=$start_date;
define end_date=$end_date;
define max_depth=$max_depth;
define min_units=$min_units;
#/app/myapp/sql/forecast
EOF
to convert to one line, is it as simple as:
sqlplus -s myID/pwd < define start_date=$start_date; define end_date=$end_date; define max_depth=$max_depth; define min_units=$min_units; #/app/myapp/sql/forecast
Thanks in advance
Assuming your one line is still be running from a shell script, which the call to sqlplus suggests, you can use a pipe rather than a redirect to pass the commands to SQL*Plus:
printf "define start_date=$start_date\ndefine end_date=$end_date\ndefine max_depth=$max_depth\ndefine min_units=$min_units\n#/app/myapp/sql/forecast" | sqlplus -s myID/pwd
Or perhaps slightly more readably, which you may disagree about:
printf "define start_date=%s\ndefine end_date=%d\ndefine max_depth=%d\ndefine min_units=%d\n#%s" $start_date $end_date $max_depth $min_units /app/myapp/sql/forecast | sqlplus -s myID/pwd
You need line breaks rather than semicolons to separate the define client commands from each other and the #.

How to create rails alias command

I have seen some developers used alias command for there projects. Like rs to run rails server.
How to create that alias rs="rails server"?
where to config that?
Is it works for window?
Is need any specific ruby or rails version?
It's about shell and not about rails. You can create alias to all commands you want. Those aliases are created on your profile like ~/.bash_profile or ~/.zshrc for example. Then to use aliases you need to study about them on documentation of shell you are using. On Windows I think Powershell supports aliases.
You don't have to put that command into a file (unless you want it to persist into the next session. To test what will work for you just put it in your terminal:
alias rs="rails server"
Then type rs. If it works you need alias, if not continue reading for doskey macros.
Now for windows, if you are running cygwin or a linux virtual machine, you use ALIAS. If you are using the Windows shell you ise DOSKEY.
doskey alias_name="some command here"
alias alias_name="some command here"
If you are on windows or 8 it doesn't like files without extensions. To create a .bashrc file, create a .bashrc. (notice the trailing .) and Windows will remove the last dot.

How to use wildcard * with graphicspath in LaTeX?

How can you have the wildcard character, for example in the following code?
\graphicspath{{1/*/pictures/}}
You can't use wildcards with \graphicspath. You'll have to be explicit:
\graphicspath{{1/pictures/}{2/pictures/}{3/pictures/}{...etc...}}
I found the LaTeX Wikibook a few months ago. It's a good reference for getting started.
It is true that wildcards can't be used within the \graphicspath command. However, you can use a workaround based on a bash script if you are running a Unix based OS.
In your example, you can create a script named myGraphicspath.sh:
#!/bin/bash
PATH="./1/*/pictures"
echo -n \\graphicspath{{./}
for i in $PATH; do
echo -n \{$i/\}
done
echo \}
Put that script in the same folder as your .tex.
Now, you can call that script from Latex. Where you would have placed the \graphicspath command, now you type:
\immediate\write18{./myGraphicspath.sh > myGraphicspath.tex}
\input{myGraphicspath.tex}

Resources