Sponsored Content
Full Discussion: Scope of exported function
Top Forums Shell Programming and Scripting Scope of exported function Post 302496560 by steadyonabix on Monday 14th of February 2011 12:26:26 PM
Old 02-14-2011
Thanks

I think this would still involve an entry in their profile or kshrc though.

I think I'll start another more detailed post about what I am trying to achieve.

Thanks for the input

---------- Post updated at 05:13 PM ---------- Previous update was at 04:56 PM ----------

Now I have the package installing this how I want I can put a lot more detail in here about what I am trying to do: -

I have a two related utilities called push and pop that I have written as exported functions. They allow me to create "stacks" of directories that are presented to the user in the form of menus: -
=============================================================
Current stack is - Packaging
=============================================================
1) /home/brad/spideroak/wip/packaging/pushpop
2) /home/brad/spideroak/wip/packaging/pushpop/debian/DEBIAN
3) /home/brad/spideroak/wip/packaging/pushpop/debian/usr/bin
4) /home/brad/spideroak/wip/packaging/pushpop/debian/usr/share/doc/pushpop
5) /var/cache/man
6) /home/brad/spideroak/wip/man/man1
7) Quit
Please select a directory -

So while I am developing something I can create a stack of all of the directories I am interested in while the development is in progress. Also if I come back to it in a months time I can reload the saved stack and I can immediately see all of the directories that relate to this project.

I thought this would be a nice project to cut my teeth on debian packaging and so I have created a package that installs the files containing the functions and environment vars into /usr/bin and adds a couple of man pages.

To access the functions I put two entries into my kshrc file: -

. /usr/bin/.pp.env
. /usr/bin/.exported.funcs

I think this is the weakness in the package though, I don't like the idea of the end users needing the knowledge of how to do this. I would like the package to take care of all dependencies.

I can't have the package modify everyones kshrc or profile. After all this is specific to korn shell users and anyway people should have the right to opt in rather than have this forced on them.

That is why I was asking about the group idea but am open to any suggestions that allow users to opt in without knowing how to find and edit their profile or kshrc.

I guess in a worst case scenario I could put details on how to enter these in the man pages.

Any ideas greatly appreciated.

---------- Post updated at 05:26 PM ---------- Previous update was at 05:13 PM ----------

Hi Folks

I've been boning up on how to create debian packages and now have a working package. I am still getting warnings though when I run it through lintean: -

Code:
/home/brad/spideroak/wip/packaging/pushpop > lintian pushpop_1.2-1_all.deb
W: pushpop: syntax-error-in-debian-changelog line 5 "found eof where expected first heading"
W: pushpop: binary-without-manpage usr/bin/.exported.funcs
W: pushpop: binary-without-manpage usr/bin/.pp.env

With regard to the errors about binaries without man pages. These are two files: one containing environment vars and the other some exported functions. The directory structure used to create the package is: -

Code:
./debian
./debian/usr
./debian/usr/bin
./debian/usr/bin/.pp.env
./debian/usr/bin/.exported.funcs
./debian/usr/share
./debian/usr/share/doc
./debian/usr/share/doc/pushpop
./debian/usr/share/doc/pushpop/copyright
./debian/usr/share/doc/pushpop/changelog.Debian.gz
./debian/usr/share/man
./debian/usr/share/man/man1
./debian/usr/share/man/man1/push.1.gz
./debian/usr/share/man/man1/pop.1.gz
./debian/DEBIAN
./debian/DEBIAN/control

How can I get rid of these warnings as I don't want man pages for the files. My man pages refer to the internal exported functions.


With regard to the warning: -

Code:
W: pushpop: syntax-error-in-debian-changelog line 5 "found eof where expected first heading"

I've been reading tutorials all day on this but can't seem to bottom out what it wants. Here is the file: -

Code:
pushpop (1.2-1) urgency=low

  * Made Debian package lintian clean.

 -- maintainer Bradley Atkins <info@bradleyatkins.com>  Sun, 13 Feb 2011 22:00:00 +0000

I think their should be a field between the name (version) and the urgency field. But the line it is complaining about is the last line.

Any ideas or insights are welcome
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

$0 scope in function and calling script

Hi folks, I'm just running through an oreilly korn shell book but have witnessed an output difference on my own unix machine and the output provided in the book. Can anyone help? create a script called ascript as follows: function afunc { print in function $0: $1 $2 var1="in... (16 Replies)
Discussion started by: beckett
16 Replies

2. Linux

Can USB Devices Be Exported Over a Network?

While I know that it's possible to use something like SANE to share a USB scanner over a network, or use NBD or iSCSI to share a USB flash or external HD over the network, I've been wondering about a raw USB <--> TCP/IP transport. Back in the late 90s, I swear I remember hearing about a project... (2 Replies)
Discussion started by: deckard
2 Replies

3. Solaris

Remove the exported zpool

I had a pool which was exported and due to some issues on my SAN i was never able to import it again. Can anyone tell me how can i destroy the exported pool to free up the LUN. I tried to create a new pool on the same pool but it gives me following error # zpool create emcpool4 emcpower0c... (0 Replies)
Discussion started by: fugitive
0 Replies

4. Shell Programming and Scripting

Seeing variable which are exported with export

Greeting to all of you! I've small issue related to the variable which we are setting and exporting through scripts, in one of the script there are some variable used but I am not abel to get the detail as where they are set. I tried finding the detail with the help of env but no luck. ... (2 Replies)
Discussion started by: kumarmani
2 Replies

5. Shell Programming and Scripting

using the exported variable after su

Dear All,How can use a variable which I have exported when I am logged into one user to be used once I su to another user.something like 1.Login to Unix box as user12. export var1="TEST"3. su - user24. User the var1 value ( it should return TEST)I have checked just export does not work. any other... (1 Reply)
Discussion started by: rahulkav
1 Replies

6. AIX

exported filesystems on a NIM server

I have a filesystem that was exported sometime in the past, probably by NIM processes, but cannot be unexported now. How can I get rid of this? Any ideas? I tried rebooting and it survived it. hostname:/:$ exportfs -v /usr/lpp/bos.sysmgt/nim/methods... (2 Replies)
Discussion started by: kah00na
2 Replies

7. Shell Programming and Scripting

Use of exported variable

i have to use the exported variable from one script into another script ex : A.ksh # !/bin/ksh chk1=56 export chk1 B.ksh # !/bin/ksh echo $chk1 i have executed the... (6 Replies)
Discussion started by: urfrnddpk
6 Replies

8. Shell Programming and Scripting

BASH: variable and function scope and subscripts

Hi, I'm a Delphi developer new to linux, new to this forums and new to BASH programming and got a new task in my work: maintaining an existing set of BASH scripts. First thing I want to do is making the code more reliable as in my opinion it's really bad written. So here's the quest: I'm... (6 Replies)
Discussion started by: rse
6 Replies

9. UNIX for Beginners Questions & Answers

Sudo has no access to exported bash function

Hello. I am running leap 15.1 sudo behavior may differ from other distrib. I have a file with functions definition .... function_1 { echo "Hello world" } export -f function_1 This file is sourced by both /etc/bash.bashrc.local and profile.local. So the functions are... (3 Replies)
Discussion started by: jcdole
3 Replies

10. UNIX for Beginners Questions & Answers

Loading associative array from exported function

Hello. I have an export of an associative array build using declare -p SOME_ARRAY_NAME > SOME_FILE_NAME.txt. Producing some thing like declare -A SOME_ARRAY_NAME=( ="some_text" ="a_text" ......... ="another_text" ) in a text file. I have a stock of functions which are sourced from... (1 Reply)
Discussion started by: jcdole
1 Replies
All times are GMT -4. The time now is 11:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy