I have already searched about this particular problem, but couldn't find anything helpful.
Let's assume I have following functions defined in my ~/.bashrc
(Note: this is pseudo-code!):
ANDROID_PLATFORM_ROOT="/home/simao/xos/src/"
function getPlatformPath() {
echo "$ANDROID_PLATFORM_ROOT"
}
function addCaf() {
# Me doing stuff
echo "blah/$(getPlatformPath)"
}
function addAosp() {
# Me doing stuff
echo "aosp/$(getPlatformPath)"
}
function addXos() {
# Me doing stuff
echo "xos/$(getPlatformPath)"
}
function addAllAll() {
cd $(gettop)
# repo forall -c "addCaf; addAosp; addXos" # Does not work!
repo forall -c # Here is where I need all those commands
}
My problem:
I need to get the functions addCaf
, addAosp
and addXos
in one single line.
Like you can run following in bash (pseudo code):
dothis; dothat; doanotherthing; trythis && succeedsdothis || nosuccessdothis; blah
I would like to run all commands inside the three functions addCaf
, addAosp
and addXos
in just one line.
Any help is appreciated.
What I already tried:
repo forall -c "bash -c \"source ~/.bashrc; addAllAll\""
But that didn't work as well.
Edit:
To clarify what I mean.
I want something like that as a result:
repo forall -c 'function getPlatformPath() { echo "$ANDROID_PLATFORM_ROOT"; }; ANDROID_PLATFORM_ROOT="/home/simao/xos/src/"; echo "blah/$(getPlatformPath)"; echo "aosp/$(getPlatformPath)"; echo "xos/$(getPlatformPath)"'
But I don't want to write that manually. Instead, I want to get those lines from the functions that already exist.