Sponsored Content
Top Forums Shell Programming and Scripting Tough question - interactive prompts Post 15703 by peter.herlihy on Monday 18th of February 2002 09:25:55 PM
Old 02-18-2002
Tough question - interactive prompts

I have inherited a script (ksh) - which requires an input file and location to be specified on the command line.....

i.e runsc MRG_060601 ../input_files/

I am trying to tidy this up by using an env variable for the location (as it is always the same) - but it will still require the name of the input file to run.

There are two things I want to do:

1. I want to be able to run multiple files from within the $LOAD
directory (my new env variable)...i.e runsc $LOAD/*

Should I do this with a for loop? Or is there a prettier way?

2. I want to write an auto-complete function that reads each character as it is entered and scans the $LOAD dir to see if it can finish the filename. (similar to bash).

So I could just type "runsc" - then when prompted start by typing..."MR" and the line would be completed for me if there was only one thing it could be - or completed as far as possible if there are multiple matches with different endings.

I imagine this is a single character read type thing - but i don't want to go to the hassle of writing a convoluted script if there is a function existing - or a nice tody method.

Full or part answers appreciated.

Smilie
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Seems the Shell Script is very tough

Guys plz respond. (1 Reply)
Discussion started by: prince_of_focus
1 Replies

2. Programming

Tough makefile question

At my company, we build some stuff using a makefile. While the makefile script is running, a developer may check in a newer version of a source file. The problem is, when we next run the make command, the target file isn't rebuilt, because the date of the target is after the dependency. Any... (1 Reply)
Discussion started by: mbbeaubi
1 Replies

3. UNIX for Advanced & Expert Users

Tough Substituion command

I have lines like: Mg2.qns W=0.175u Mg2.qpsb W=0.175u Mg4.qns W=0.175u Mg4.qpsb W=0.175u Which I need to become: Mg2.qns W=wmg2qns Mg2.qpsb W=wmg2qpsb Mg4.qns W=wmg4qns Mg4.qpsb W=wmg4qpsb To acheive this individually line by line I use a command like:... (3 Replies)
Discussion started by: ggggdddd
3 Replies

4. UNIX for Dummies Questions & Answers

tough parsing

I have a string as "Period= 20090531 Client Name= Clayton Lumbar Company Destination= MD" I want to parse the string and store it in 3 different variables. $period (should get value 20090531) $client (should get value "Clayton Lumbar company") $dest (should get value MD) How can I do... (3 Replies)
Discussion started by: paruthiveeran
3 Replies

5. Homework & Coursework Questions

Help with Interactive / Non Interactive Shell script

Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines. It then prompts for deletion of the file. If user supplies arguments with the script , then it works on those files... (1 Reply)
Discussion started by: rits
1 Replies

6. Homework & Coursework Questions

How to write script that behaves both in interactive and non interactive mode

Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines. It then prompts for deletion of the file. If user supplies arguments with the script , then it works on those files... (8 Replies)
Discussion started by: rits
8 Replies

7. Shell Programming and Scripting

A very tough exercise

hello everyone!:) I have an exercise which I think is difficult for beginner like me. Here is the exercise Create a shell script, which takes a directory as command line argument. Script displays ten first lines from every text file in that directory. After displaying the lines from the... (1 Reply)
Discussion started by: googlevn
1 Replies
MODULES-LOAD.D(5)						  modules-load.d						 MODULES-LOAD.D(5)

NAME
modules-load.d - Configure kernel modules to load at boot SYNOPSIS
/etc/modules-load.d/*.conf /run/modules-load.d/*.conf /usr/lib/modules-load.d/*.conf DESCRIPTION
systemd-modules-load.service(8) reads files from the above directories which contain kernel modules to load during boot in a static list. Each configuration file is named in the style of /etc/modules-load.d/program.conf. Note that it is usually a better idea to rely on the automatic module loading by PCI IDs, USB IDs, DMI IDs or similar triggers encoded in the kernel modules themselves instead of static configuration like this. In fact, most modern kernel modules are prepared for automatic loading already. CONFIGURATION FORMAT
The configuration files should simply contain a list of kernel module names to load, separated by newlines. Empty lines and lines whose first non-whitespace character is # or ; are ignored. CONFIGURATION DIRECTORIES AND PRECEDENCE
Configuration files are read from directories in /etc/, /run/, and /lib/, in order of precedence. Each configuration file in these configuration directories shall be named in the style of filename.conf. Files in /etc/ override files with the same name in /run/ and /lib/. Files in /run/ override files with the same name in /lib/. Packages should install their configuration files in /lib/. Files in /etc/ are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages. All configuration files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in. If multiple files specify the same option, the entry in the file with the lexicographically latest name will take precedence. It is recommended to prefix all filenames with a two-digit number and a dash, to simplify the ordering of the files. If the administrator wants to disable a configuration file supplied by the vendor, the recommended way is to place a symlink to /dev/null in the configuration directory in /etc/, with the same filename as the vendor configuration file. If the vendor configuration file is included in the initrd image, the image has to be regenerated. EXAMPLE
Example 1. /etc/modules-load.d/virtio-net.conf example: # Load virtio-net.ko at boot virtio-net SEE ALSO
systemd(1), systemd-modules-load.service(8), systemd-delta(1), modprobe(8) systemd 237 MODULES-LOAD.D(5)
All times are GMT -4. The time now is 12:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy