07-12-2007
if we want to access the variable across the shell also the entire UNIX server, you can create a variable in ENV file. but you should use the "export" keyword prefix of the variable.
eg:
export VAR_NAME;
Then you can access the variable name VAR_NAME in across the shell and acros the unix server for you username login.
Thanks,
Siva.P
Bangalore
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
I know to set global variable i can use export .. But take the situation like below ..
I want to set a variable in one script and access that in second script
i have done like this .. It is not working
one.sh
#!/usr/bin/ksh
echo $RISSHI
export RISSHI=1
two.sh... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
2. Shell Programming and Scripting
I wrote a awk script file and define some global variables after BEGIN option:
BEGIN {
cell = "";
alarm = "";}
when i run the command:
awk -f awk_script inputfile
The results are as expected. But when I put awk script into a shell script. Global variables couldn't be understand.
I don't... (1 Reply)
Discussion started by: anhtt
1 Replies
3. Shell Programming and Scripting
In ksh I thought a global variable was any variable in a script or function that did not have the typeset command. I have a global in my calling script which I increment in a function, but the value does not change in the calling script. Here is the code:
function f_open_log
{
typeset -r... (5 Replies)
Discussion started by: robotball
5 Replies
4. Shell Programming and Scripting
I have written a shell scritp in which i am using a variable which is declared before a while loop and i am updaitng the variable in while loop and want to use its updated value outside the loop. I am not able to do so, b'coz the scope of the variable is limited to the while loop only and when i am... (5 Replies)
Discussion started by: deepanshu
5 Replies
5. Shell Programming and Scripting
Hi Guyz,
I have a requirement like, i have to run a script every hour to count the number of errors encountered.
At the end of the day, i need to send them the total number of errors, that have ocurred the entire day.
For eg. if 10 errors occurred for starting 1 hr, 5 for next 1 hr, so on.... (1 Reply)
Discussion started by: DTechBuddy
1 Replies
6. Programming
I need to use the below global structure defined in code1.c in another code2.c
struct memIOptrs
{
const char *name;
unsigned char *virtptr;
}MEM_IO_PTRS;
I have a header file for the project codes.h, how should the structure be declared here.
Also, what if the structure was... (1 Reply)
Discussion started by: dragonpoint
1 Replies
7. Shell Programming and Scripting
Hi All,
Im new to shell scripting. I am running EgA.sh and setting one global variable XYZ=0 . Also calling another EgB.sh from EgA.sh, changing the value of XYZ=10
but after executing EgB.sh, value of XYZ is still 0. Im expecting it to be 10.
Anyone for help. Thanks in Advance. :) (5 Replies)
Discussion started by: paliwal
5 Replies
8. UNIX for Advanced & Expert Users
Is there anyway in which i can set a permanent global variable in unix, which when initialised with a value and modified during any shell script, would retain its value even if i logout and login
I dont know whether i am being able to express my need clearly but basically what i want is a... (3 Replies)
Discussion started by: arindamlive
3 Replies
9. Shell Programming and Scripting
Hi,
I have created a variable say today at the begin having 123 as its value and inside a for loop it gets resolved to some value say 150 in its first iteration.
How can I use this value 150 ( 1st iteration's ) outside the scope of for loop ?. In the same way I wanted to use all iteration's... (1 Reply)
Discussion started by: penqueen
1 Replies
10. Shell Programming and Scripting
Hi,
I am using Linux and sh shell
count=7
find * -prune -type d | sort -r -n | ( while read d; do
if ; then
echo "FOUND COUNTER1 is: $count"
break 2;
fi
done
echo "FOUND COUNTER2 is: $count" )
if ; then
echo "Problem: Multiple or NO records...Please CHECK !!"
fi
Output: ... (4 Replies)
Discussion started by: mohtashims
4 Replies
LEARN ABOUT MOJAVE
git-shell
GIT-SHELL(1) Git Manual GIT-SHELL(1)
NAME
git-shell - Restricted login shell for Git-only SSH access
SYNOPSIS
chsh -s $(command -v git-shell) <user>
git clone <user>@localhost:/path/to/repo.git
ssh <user>@localhost
DESCRIPTION
This is a login shell for SSH accounts to provide restricted Git access. It permits execution only of server-side Git commands implementing
the pull/push functionality, plus custom commands present in a subdirectory named git-shell-commands in the user's home directory.
COMMANDS
git shell accepts the following commands after the -c option:
git receive-pack <argument>, git upload-pack <argument>, git upload-archive <argument>
Call the corresponding server-side command to support the client's git push, git fetch, or git archive --remote request.
cvs server
Imitate a CVS server. See git-cvsserver(1).
If a ~/git-shell-commands directory is present, git shell will also handle other, custom commands by running "git-shell-commands/<command>
<arguments>" from the user's home directory.
INTERACTIVE USE
By default, the commands above can be executed only with the -c option; the shell is not interactive.
If a ~/git-shell-commands directory is present, git shell can also be run interactively (with no arguments). If a help command is present
in the git-shell-commands directory, it is run to provide the user with an overview of allowed actions. Then a "git> " prompt is presented
at which one can enter any of the commands from the git-shell-commands directory, or exit to close the connection.
Generally this mode is used as an administrative interface to allow users to list repositories they have access to, create, delete, or
rename repositories, or change repository descriptions and permissions.
If a no-interactive-login command exists, then it is run and the interactive shell is aborted.
EXAMPLE
To disable interactive logins, displaying a greeting instead:
$ chsh -s /usr/bin/git-shell
$ mkdir $HOME/git-shell-commands
$ cat >$HOME/git-shell-commands/no-interactive-login <<EOF
#!/bin/sh
printf '%s
' "Hi $USER! You've successfully authenticated, but I do not"
printf '%s
' "provide interactive shell access."
exit 128
EOF
$ chmod +x $HOME/git-shell-commands/no-interactive-login
To enable git-cvsserver access (which should generally have the no-interactive-login example above as a prerequisite, as creating the
git-shell-commands directory allows interactive logins):
$ cat >$HOME/git-shell-commands/cvs <<EOF
if ! test $# = 1 && test "$1" = "server"
then
echo >&2 "git-cvsserver only handles "server""
exit 1
fi
exec git cvsserver server
EOF
$ chmod +x $HOME/git-shell-commands/cvs
SEE ALSO
ssh(1), git-daemon(1), contrib/git-shell-commands/README
GIT
Part of the git(1) suite
Git 2.17.1 10/05/2018 GIT-SHELL(1)