Using variables when defining aliases in bashrc

I am trying to reuse alias variables while defining other aliases in .bashrc file as shown below:

alias cwd='cd /work/local/assignment1' alias module1='$(cwd)/module1' 

This does not work and I would like to know whether it is possible to use variables while defining aliases.

Any help is appreciated.

Replay

Your cwd is not a variable but an alias. You could instead do:

cwd='cd /work/local/assignment1'
alias module1='$cwd/module1'

As suggested by @StephenHarris, you may want to add the following to get your cwd working as usual:

alias cwd='$cwd'

Category: shell script Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.142 (s). 12 q(s)