Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example, having typed:

bash$ java -cp lib/*.jar Something

How to quickly get to

bash$ java -cp lib/library1.jar:lib/library2.jar:lib/library3.jar Something

(or equivalent)

Is there a shortcut like Alt+*, but with ":" instead of " "?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

This is as convenient as I can muster

CP() { local IFS=:; echo "$*"; }    # perhaps put this in your .bashrc

java -cp "$(CP lib*/jar)" Something
share|improve this answer
add comment

Try this. The $(...) construct is command substitution. It runs what's inside and pastes the output back on the command line in its place.

java -cp $(for i in lib/*.jar; do echo -n $sep$i; sep=:; done) Something
share|improve this answer
    
It is not convenient; it's a little in-place program that is often even longer than just TAB-complete the libraries one by one (I do such things when there are many libraries). Is there a convenient way? Can I add a shortcut like Alt+*, but with other separator? –  Vi. Nov 18 '12 at 2:55
    
this is what Ant or make is for. The way to make it convenient is to use those or to write a bash script and execute it with ./myscript. –  memnoch_proxy Nov 4 '13 at 14:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.