Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make a compatible "say" command on Linux. So far this works:

alias say='echo "$1" | espeak -s 120 2>/dev/null'

I'm adding this to /etc/bash.bashrc. Problem is, this say is called from my_ruby_file.rb. I understood what's the problem, but I cannot change the file. The Ruby file uses sh, and not bash. My question is, how can I use this alias so say would be available in all shells?

share|improve this question
Also, aliases do not use positional parameters. You would need to use a function: say() { espeak -s 120 2>/dev/null <<< "$*"; }. But @John has given you the correct answer. – glenn jackman Jan 24 '13 at 22:05
up vote 1 down vote accepted

Each shell has it's own alias file. You'll have to add the alias to each shell's file, and even then you're not guaranteed to read the alias file from a shell exec'ed from Ruby. You're better off (in this case) creating a script called "say" somewhere in the path recognized in your .rb file instead of a shell alias.

share|improve this answer

Your Answer


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.