Sponsored Content
Full Discussion: Get execute result of su
Top Forums Shell Programming and Scripting Get execute result of su Post 302286825 by rakeshou on Thursday 12th of February 2009 03:11:12 AM
Old 02-12-2009
not tested

try echoing the value like

RETURN_VAL=`su user << EOF
some commands
result=$?
echo $result
EOF`

echo $RETURN_VAL
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies

2. Shell Programming and Scripting

script execute or no execute

o hola.. Tengo un script que se ejecuta bajo una tarea del CronJOb del unix, tengo la version 11 de unix, mi script tiene un ciclo que lee unos archivos .txt luego cada uno de esos archivos debe pasar por un procedimiento almacenado el cual lo tengo almacenado en mi base de datos oracle 10g,... (4 Replies)
Discussion started by: Kespinoza97
4 Replies

3. Shell Programming and Scripting

Outputting formatted Result log file from old 30000 lines result log<help required>

Well I have a 3000 lines result log file that contains all the machine data when it does the testing... It has 3 different section that i am intrsted in 1) starting with "20071126 11:11:11 Machine Header 1" 1000 lines... "End machine header 1" 2) starting with "20071126 12:12:12 Machine... (5 Replies)
Discussion started by: vikas.iet
5 Replies

4. UNIX for Dummies Questions & Answers

display the result of wc -l with words before and after the result

hello showrev -p | wc -l returns: 381 What to do in case I want to have this output: number of lines returned by showrev -p is: 381 thx (3 Replies)
Discussion started by: melanie_pfefer
3 Replies

5. Shell Programming and Scripting

Use grep result to execute next command

Hi I am trying to run 2 servers using a script one after the other. I start the first one: run.sh -c servername >> jboss_log.txt & Then I have to wait until I see Started message in the log file before I launch the other server. I can't use sleep because I am not sure how long it'll... (5 Replies)
Discussion started by: iririr
5 Replies

6. UNIX for Dummies Questions & Answers

what is the result of this?

ls -A $variable (2 Replies)
Discussion started by: prathimahsc
2 Replies

7. Shell Programming and Scripting

Different cmd to execute and based on some pattern parse it and then store result in xlx format

Hi I have a different requirement, I need to run some application on my device from a file app_name.txt one by one which is like this: /usr/apps/email /usr/apps/message /usr/apps/settings after each app while it is running I need to execute again one cmd like ps -ef |grep... (2 Replies)
Discussion started by: Sanjeev Roy
2 Replies

8. Shell Programming and Scripting

How to compare the current result with previous line result.?

Hi Gurus, I have requirement to compare current result with previous reuslt. The sample case is below. 1 job1 1 1 job2 2 1 job3 3 2 job_a1 1 2 job_a2 2 2 job_a3 3 3 job_b1 1 3 job_b2 2 for above sample file, GID is group ID, for input line, the job run... (1 Reply)
Discussion started by: ken6503
1 Replies

9. Shell Programming and Scripting

Execute command and show result in web page

Hi everyone, I have two question 1- I want to execute command in shell and after execution result show in a web server. (kind of making UI ) e.g. in shell root ~: show list item1 item2 item(n)in web server in a page draw a table and show those items in itno | name... (1 Reply)
Discussion started by: indeed_1
1 Replies

10. UNIX for Beginners Questions & Answers

Search a multi-line shell command output and execute logic based on result

The following is a multi-line shell command example: $cargo build Compiling prawn v0.1.0 (/Users/ag/rust/prawn) error: failed to resolve: could not find `setup_panix` in `human_panic` --> src/main.rs:14:22 | 14 | human_panic::setup_panix!(); | ... (2 Replies)
Discussion started by: yogi
2 Replies
pam_start(3PAM) 														   pam_start(3PAM)

NAME
pam_start, pam_end - PAM authentication transaction functions SYNOPSIS
cc [ flag ... ] file ... -lpam [ library ... ] #include <security/pam_appl.h> int pam_start(const char *service, const char *user, const struct pam_conv *pam_conv, pam_handle_t **pamh); int pam_end(pam_handle_t *pamh, int status); The pam_start() function is called to initiate an authentication transaction. It takes as arguments the name of the current service, ser- vice, the name of the user to be authenticated, user, the address of the conversation structure, pam_conv, and the address of a variable to be assigned the authentication handle pamh. Upon successful completion, pamh refers to a PAM handle for use with subsequent calls to the authentication library. The pam_conv structure contains the address of the conversation function provided by the application. The underlying PAM service module invokes this function to output information to and retrieve input from the user. The pam_conv structure has the following entries: struct pam_conv { int (*conv)(); /* Conversation function */ void *appdata_ptr; /* Application data */ }; int conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr); The conv() function is called by a service module to hold a PAM conversation with the application or user. For window applications, the application can create a new pop-up window to be used by the interaction. The num_msg parameter is the number of messages associated with the call. The parameter msg is a pointer to an array of length num_msg of the pam_message structure. The pam_message structure is used to pass prompt, error message, or any text information from the authentication service to the application or user. It is the responsibility of the PAM service modules to localize the messages. The memory used by pam_message has to be allocated and freed by the PAM modules. The pam_message structure has the following entries: struct pam_message{ int msg_style; char *msg; }; The message style, msg_style, can be set to one of the following values: PAM_PROMPT_ECHO_OFF Prompt user, disabling echoing of response. PAM_PROMPT_ECHO_ON Prompt user, enabling echoing of response. PAM_ERROR_MSG Print error message. PAM_TEXT_INFO Print general text information. The maximum size of the message and the response string is PAM_MAX_MSG_SIZE as defined in <security/pam.appl.h>. The structure pam_response is used by the authentication service to get the user's response back from the application or user. The storage used by pam_response has to be allocated by the application and freed by the PAM modules. The pam_response structure has the following entries: struct pam_response{ char *resp; int resp_retcode; /* currently not used, should be set to 0 */ }; It is the responsibility of the conversation function to strip off NEWLINE characters for PAM_PROMPT_ECHO_OFF and PAM_PROMPT_ECHO_ON mes- sage styles, and to add NEWLINE characters (if appropriate) for PAM_ERROR_MSG and PAM_TEXT_INFO message styles. The appdata_ptr argument is an application data pointer which is passed by the application to the PAM service modules. Since the PAM mod- ules pass it back through the conversation function, the applications can use this pointer to point to any application-specific data. The pam_end() function is called to terminate the authentication transaction identified by pamh and to free any storage area allocated by the authentication module. The argument, status, is passed to the cleanup(|) function stored within the pam handle, and is used to deter- mine what module-specific state must be purged. A cleanup function is attached to the handle by the underlying PAM modules through a call to pam_set_data(3PAM) to free module-specific data. Refer to Chapter 3, "Writing PAM Applications and Services", of the for information about providing authentication, account management, session management, and password management through PAM modules. Refer to the section on pam(3PAM). See attributes(5) for description of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability | Stable | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe with exceptions | +-----------------------------+-----------------------------+ libpam(3LIB), pam(3PAM), pam_acct_mgmt(3PAM), pam_authenticate(3PAM), pam_chauthtok(3PAM), pam_open_session(3PAM), pam_setcred(3PAM), pam_set_data(3PAM), pam_strerror(3PAM), attributes(5) The interfaces in libpam are MT-Safe only if each thread within the multithreaded application uses its own PAM handle. 22 Feb 2005 pam_start(3PAM)
All times are GMT -4. The time now is 01:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy