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.

In my .screenrc, I have several lines similar to the following:

screen -t qf1 bash

So for that window, I am currently executing bash. Instead, I would like to execute the following alias "qf" which is a bash alias that executes lynx for a certain URL.

However, I get the following error:

"Cannot exec 'qf': No such file or directory"

I know it probably has something to do with the path, but providing:

screen -t qf1 lynx www.google.com

Doesn't work either. I know I'm missing something obvious. Thanks!

share|improve this question
    
See the answer(s) to How to start bash and immediately “type” command into it?. –  Scott May 7 '13 at 0:03
add comment

1 Answer

up vote 2 down vote accepted

Most likely, your bash aliases are not available to screen. There's a couple ways to fix this.

  • If your aliases are in .bash_profile, move them to .bashrc
  • Start your bash shells with the -l switch to force bash to parse .bash_profile

Have a look at this question for a similar issue.

EDIT

There's actually two things that keep this from working:

Use bash's command-string syntax to pass commands to the new window

    screen -t "YayScreen" bash -c "man screen"

Aliases are a pain in screen

Create a bash script with the desired name in your $PATH (say, /bin), and call that in the same way as the above example. For example, I have a very simple alias called psgrep that looks for a process by name. I create this script as /bin/psgrep:

#!/bin/bash
ps aux | grep -v grep | grep $1

Then I can add this to my .screenrc:

screen -t "Useless Command" bash -c "psgrep gnome"

See this old Mac OS X forum post for a longer list of what didn't work.

share|improve this answer
    
Ok, I tried doing "screen -t qf1 bash -l qf" with no luck. I did see that question already. I think this question is more about the syntax of .screenrc. –  cat pants May 7 '13 at 3:21
    
Ah. I didn't read your original question closely enough. Adding another answer now. –  Lemur May 7 '13 at 18:08
    
Or just an edit. That works, too. –  Lemur May 7 '13 at 19:51
    
Perfect, that is exactly what I needed. Thanks a ton!! –  cat pants May 8 '13 at 20:25
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.