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.

Using: CentOS 6.2 BASH Script

I regularly install CUDA (a GPU programming API) on machines in my work cluster, and have to reupgrade three *.run installers whenever I do an upgrade version-wise.

The installers are semi-predictably named (though NVIDIA sometimes changes up the naming scheme) so I've created a script that switches to the root user, takes the run level down to 3 to turn off any running X server instances, calls the most RECENT version in my installers directory with sh ls -t base_<name>*.run|head -n 1 and then finally switches the run level back to 5.

Now this is nice as it reduces intervention, but what I really would love to do is automatically input the enter/arrow sequences to the *.run autonomously from the script, as they're the exact same every time. Is there a good way to do this for *.run files?? You don't have to give me a full answer even, just pointing me towards a good tutorial would be educational.

Also, on the odd chance someone with CUDA experience sees this, any idea if there's a repository that I can get the latest dev drivers; gpu tools installer (nvcc, etc.); and gpu SDK from? (these are my three *.run installers) I can go in my browser and download all of these, but a command line scriptable way would be super nice as then I'd cut out one more step! :)

share|improve this question
1  
Have you tried passing -h or --help to see if you can use arguments to automate it? –  Ignacio Vazquez-Abrams Apr 13 '12 at 20:07
    
@IgnacioVazquez-Abrams Typing this (plus sh gave a "Getting" and "Running" section. The part that sounds promising was in the Running section which says that option -- results in Following arguments will be passed in the embedded script. Assuming this is what I need, how do I tell what those argument are? –  Jason R. Mick Apr 13 '12 at 21:32
    
Try passing -- -h then. –  Ignacio Vazquez-Abrams Apr 13 '12 at 21:37

1 Answer 1

up vote 1 down vote accepted

You can try coding up an Expect script to handle this. I'm not sure if it can do arrow keys, but I've used it to automate command line inputs to commands/scripts in the past. These links may be useful if you go that route.

share|improve this answer
    
Ah your answer is perfect... It will handle everything besides the driver.... actually knowing what to search for, I even found a post explaining how to do this: forums.nvidia.com/index.php?showtopic=195758 –  Jason R. Mick Apr 13 '12 at 21:34
    
I'm glad that helped. I've used it for a few scripts and I'd feel so lost without it. It's a great tool IMO. –  sbtkd85 Apr 16 '12 at 12:22

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.