-1

This alias searching a folder and printing out the location of the folder.

findme 1234567                  --> Searching and printing 
/xxx_data/xxe/TK/1234567/       --> This is the output of above alias.
alias findme='program -x SR $1' --> This is the alias. 

is there way to redefine this alias that when I run findme 1231412 it will directly pass the user input into cd and enter to subfolder.

Example

findme 1234567                   
/xxx_data/xxe/TK/1234567 <-- From here I do cd /xxx_data/xxe/TK/1234567/Allfiles

Find me searched and printed the folder location, but I wanted this alias to actually do cd into subfolder(Allfiles) of the finded folder. like this

/xxx_data/xxe/TK/1234567/Allfiles <-- so how can I define an alias that can read user input findme and pass it to cd command 

in this file structure only thing change is the number /xxx_data/xxe/TK//Allfiles

  • Despite the example it's not really clear to me what you're asking. Please show us some code or script, tell us the current behavior, the desired behavior, and what you've tried to achieved that yet. – blue112 Oct 14 '16 at 13:02

1 Answers1

2

Aliases do not take arguments. Use a function

findme () {
  cd  "$(program -x SR "$1")"
}
chepner
  • 389,128
  • 51
  • 403
  • 529