There is a better way of doing what you want to do using FPATH and/or autoload
For example, suppose you create the following directory within your home directory and put your function scripts in this directory. The filename should be the function name.
mkdir ~/.kshfunctions
In your .kshrc file, define the FPATH variable to point to that directory:
export FPATH=~/.kshfunctions
Functions will then be loaded on an as needed basis and results in faster script startup. To get a listing of which functions are actually currently loaded, just type 'functions' at the prompt. Use whence to find a function.
hi friends,
i'm new to unix and straight away i had to start with the script files.
I've a script file which gets called from a menu item on a GUI.
This script file again calls .awk file, in performing some tasks , which also generates certain files.
I modified the files to generate some... (1 Reply)
Simple shell script :
date
test_fn()
{
echo "function within test shell script "
}
on the shell prompt I run
> . test
Then I invoke the function on the command line as below :
test_fn()
It echos the line
function within test shell script
and works as expected.
... (5 Replies)
hi friends,
I am working with shell commands and all these works properly.
Then i created a small function which includes these commands.
Now the problem arises. When the commands are run by calling this fuction.it
shows error.
Why i am not able to run the unix command inside a function.... (1 Reply)
Hi,
I have a K shell
a.ksh
function abc {
// Some logic
}
In
b.ksh
i have included the a.ksh
./a.ksh
I want to call the abc function from this b.ksh script.
Thanks
Vijay (2 Replies)
Hi there,
I have an script reading content of a file and runs whatever command is specified there, as follows
#!/bin/bash
# Supposed to read from a file that commands are listed to be run
# when the server starts for initialization
CMD_FILE=/myScripts/startup/task2do.txt
if ; then
... (2 Replies)
hey guys,
i made up a library file called common.lib so as to reuse the same code without typing it again. here is the code. its pretty basic .
## This is the second function
compare()
{
file1 = $1
file2 = $2
cmp $file1 $file2
if
then
echo "comparison is possible"... (1 Reply)
Hello gurus,
I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script.
i m looking for something like this
call 3.1;
If 3.1 = "complete" then
call 3.2;
if 3.2 = ''COMPlete" then
call 3.3;
else
exit
The... (1 Reply)
Greetings,
I m wondering if it's possible do do the following :
I have a simple function called "FindMoveDelete" which does the following :
FindMoveDelete()
{
find . -iname "$FILENAME*.ext" -exec mv {} "$PATH/$VAR" \; &&
find . -maxdepth 1 -type d -iname "$FILENAME*" -exec rm -rf {}... (6 Replies)
so i have a very big script that has the following format:
functionA () {
....
...
....
}
Results=$(functionA)
the code inside of functionA is very huge. so by the time the script gets to the "Results=" part, several seconds have already passed. the script is about 15MB in size.... (4 Replies)
I want to find c function definition with pattern with shell script by checking condition for each line:
data_type
functionname(param_list){
....
}
I knew cscope or ctag is usable for this task, but if there any ways to do without using them.
I am thinking of checking line condition... (3 Replies)
Discussion started by: cmdcmd
3 Replies
LEARN ABOUT SUSE
confmodule
CONFMODULE(3) Library Functions Manual CONFMODULE(3)NAME
confmodule - communicate with Debian configuration system FrontEnd.
SYNOPSIS
#!/bin/sh -e
. /usr/share/debconf/confmodule
db_version 2.0
db_capb 'backup'
CAPB=$RET
db_input 'foo/bar' || true
db_go || true
DESCRIPTION
This is a library of shell functions that eases communication with Debian's configuration management system. It can communicate with a
FrontEnd via the debconf protocol. The design is that each command in the protocol is represented by one function in this module. The func-
tionname is the same as the command, except it is prefixed with "db_" and is lower-case. Call the function and pass in any parameters you
want to follow the command. Any textual return code from the FrontEnd will be returned to you in the $RET variable, while the numeric
return code from the FrontEnd will be returned as a return code (and so those return codes must be captured or ignored).
NOTES
Once this library is loaded, any text you later output will go to standard error, rather than standard output. This is a good thing in gen-
eral, because text sent to standard output is interpreted by the FrontEnd as commands. If you do want to send a command directly to the
FrontEnd, you must output it to file descriptor 3, like this:
echo GET foo/bar >&3
The library checks to make sure it is actually speaking to a FrontEnd by examining the DEBIAN_HAS_FRONTEND variable. If it is set, a Fron-
tEnd is assumed to be running. If not, the library turns into one, and runs a copy of the script that loaded the library connected to it.
This means that if you source this library, you should do so very near to the top of your script, because everything before the sourcing of
the library may well be run again.
SEE ALSO debconf-devel(7), dpkg-preconfigure(8), dpkg-reconfigure(8), debconf_specification in the debian-policy package
AUTHOR
Joey Hess <joeyh@debian.org>
CONFMODULE(3)