bugGNU Screen - Bugs: bug #57629, Positional parameters in screenrc...

 
 

bug #57629: Positional parameters in screenrc file?

Submitted by:  Carl Ponder <carlponder>
Submitted on:  Sun 19 Jan 2020 04:30:26 AM UTC  
 
Category:  Feature Request Severity:  3 - Normal
Priority:  5 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  4.7.0
Fixed Release:  None Planned Release:  None
Work Required:  None

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 06 Apr 2020 01:36:28 PM UTC, comment #3: 

I dislike this 2-level approach since it really junks up the contents of the script.

Instead I wrote a utility (in the spirit of "xargs") that translates the argument-list into indexed ARGV variables

        argv ./screenrc config.xml

and assigns ARGV1=config.xml where the $ARGV1 variable can be used inside the screenrc file.

This isn't perfect but (I think) keeps it more readable.

Carl Ponder <carlponder>
Sun 19 Jan 2020 10:50:06 PM UTC, comment #2: 

At this point I think you are asking too much of how screen parses command line and would be better served by shell scripts around screen instead.

There is nothing stopping shell script from generating a temporary screenrc file.
And running screen with it.

I'm even surprised that you can create executable screenrc and that it works ;)

I would try something like this:

#!/bin/sh

TEMP=$(mktemp /tmp/generated-screenrc.XXXXXXXX)
echo "focus right" >> ${TEMP}
echo "screen -t \"Director Process\""
echo "exec ... ./bin/director ${1} localhost"

screen -c${TEMP}

Amadeusz Sławiński <amade>
Project Administrator
Sun 19 Jan 2020 04:31:54 AM UTC, comment #1: 

This is vaguely related to the problem of exposing more environment-variables for expansion, as noted in

     https://savannah.gnu.org/bugs/index.php?57628

Carl Ponder <carlponder>
Sun 19 Jan 2020 04:30:26 AM UTC, original submission:  

If I put this at the top of a "screenrc" file

     #!/usr/bin/screen -c

and mark the file executable

     -rwxr-xr-x 1 cponder dip 1094 Jan 18 20:19 screenrc

I can actually run it as a command and use the screenrc programming convention to open windows and execute commands in them.
What I'd like to do, though, is also pass a parameter to this script on the command-line, like

     ./screen config.1.xml

and be able to use it inside the file, like

     focus right
     screen -t "Director Process"
     exec ... ./bin/director $1 localhost

so the command-line parameter gets expanded on the 3rd line above.

Carl Ponder <carlponder>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by amade (Posted a comment)
  • -email is unavailable- added by carlponder (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.6