Sponsored Content
Top Forums Shell Programming and Scripting How to use functions as a system commands? Post 302621887 by rbatte1 on Wednesday 11th of April 2012 08:22:36 AM
Old 04-11-2012
It is a little unclear what you want. I am guessing that you have written some functions that you might want to call from the shell command prompt any time, rather than having to write a script, define them in there and call them how you need each time.

I think that if you have these functions in a file (let's call it myfunctions) then you are wanting to make them available to the current shell. Try:-
Code:
. myfunctions

The leading "dot space" is important. This will execute the myfunctions file and load any functions to the current shell, so if you had:-
Code:
#myfunctions file
first()
{
 echo "Good morning!"
}

second()
{
 echo "Good afternoon!"
}

Then you could do the following:-
Code:
$ .  myfunctions
$ first
Good morning!
$ second
Good afternoon!
$

Is that the sort of thing you are after? If not, then do reply and explain where I have completely missed the point.



I hope that this helps
Robin
Liverpool/Blackburn
UK
 

10 More Discussions You Might Find Interesting

1. AIX

commands to get system specs

Hi, I want to find some information regarding system specs such as CPU speed, total disk space, total RAM, network topology eg. ethernet, patch number, OS patches, database. Thanks (2 Replies)
Discussion started by: DarReNz
2 Replies

2. Solaris

rsh commands not getting executed from Solaris 10 System to AIX System

Hi Friends, I am trying to execute rsh commands from Solaris 10 system to AIX system. When I give; Solaris10# rsh <hostname> ls -l , it gives me an error rshd : 0826-826 The host name for your address is not known At the same time, Solaris10# rsh <hostname> ---- gives me remote shell of... (25 Replies)
Discussion started by: jumadhiya
25 Replies

3. AIX

Need AIX system commands

Hey Guyz, I am preparing an inventory kindof thing about the aix servers.. I need help to find out the below details for many AIX servers.. Machine model and version Disk Size RAM size no. of CPUs and thier information list of softwares installed I searched in web.. but not much info I... (4 Replies)
Discussion started by: thariqueakbar
4 Replies

4. Shell Programming and Scripting

system functions

Hi guys i wanna to buil small pro as calc to do many things for example clear memory specify a memory register and so on and quit using scripting language like perl or awk which command i use to deal with memory like m0 and how to clear or specify regester... (2 Replies)
Discussion started by: Ame
2 Replies

5. Linux

commands of linux operation system

Am actually am new to the linux operating system and knda wana knw more about it.Please could u help me with some commands so i can start with that first.Really need your help (5 Replies)
Discussion started by: GODBLESSME
5 Replies

6. Programming

Difference between system calls and normal functions in C

hello all, i'm a beginner in linux programming. I need to know what is the difference between system calls and normal functions like fopen, fread etc in C?Also how to set permissions by using open system call? (11 Replies)
Discussion started by: aarathy
11 Replies

7. Shell Programming and Scripting

how to fetch the commands at solaris system

:wall:i'm system administrator. now i have a trouble. i want to fetch the command which the login users performed by shell.but i don't know how to process this problem.if anyone tell me how to do this work I would be very grateful.thank you! (4 Replies)
Discussion started by: anline5104
4 Replies

8. Programming

man pages for commands and functions of same name?

Hi friends, I hope everyone is fine and doing well. I am facing this irritating problem. As you know that manual pages are available for both unix commands and c functions. Now when I try to check the manual pages for functions like read write exit I get the manual pages for the... (3 Replies)
Discussion started by: gabam
3 Replies

9. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies

10. UNIX for Dummies Questions & Answers

File System & commands

Hello! Is File System stored in unix kernel or in pc memory? Are unix commands stored in kernel? many thanks! (1 Reply)
Discussion started by: pinklemon
1 Replies
platform::shell(3tcl)					       Tcl Bundled Packages					     platform::shell(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(3tcl)
All times are GMT -4. The time now is 02:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy