Sponsored Content
Top Forums Shell Programming and Scripting Trying to implement count_collatz_step function Post 302956845 by Bunchhieng on Sunday 4th of October 2015 07:10:00 PM
Old 10-04-2015
Quote:
Originally Posted by wisecracker
I am assuming this is homework but IF NOT then:-

Take a look at using $1 in your script, (assuming the shell is bash).
This is not homework. I actually implemented this in C and want to make it work on Bash. I just started to learn Bash a few days ago.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how can i implement rlogin

how can i use a rlogin with out entered a password, someone tell me about configure the next files /.rhosts /etc/hosts.equiv and /etc/hosts but i not sure about that, or there are not enough could you tell me how to do that? (3 Replies)
Discussion started by: jav_v
3 Replies

2. Programming

how does va_arg implement ?

1 . How does va_arg implemented by system? (2 Replies)
Discussion started by: chenhao_no1
2 Replies

3. AIX

how to implement timer

anyone can help me how to implement the timer on AIX? I tried with 'setitimer' and its related functions, but it does not work correctly,the program exited each time. thanks (2 Replies)
Discussion started by: Frank2004
2 Replies

4. Programming

How to implement polling for a function using timer in C?

Hi, Can you please help me in implementing a timer based polling for function in C? ie. the function should be called in say 30secs(when 30secs has lapsed). Thanks (7 Replies)
Discussion started by: naan
7 Replies

5. Shell Programming and Scripting

how to implement this

Hi all, could any of you please help me on my problem.. we are doing FTP (one report out put) from one server to another server through unix shell script program. Due to the network issues, some times FTP process is hanging. So we planned to modify the existing program with the following... (2 Replies)
Discussion started by: kishore_jasthi
2 Replies

6. Shell Programming and Scripting

Want to implement VLOOKUP (Excel function) in Unix

Dear All, i want to implement vookup function which is there in excel into Unix. Suppose i have 2 files. The files are given below. File1: MSC Cell SDCA Patna-1 12 Bihar Patna-2 45 Ranchi Bhopal-1 85 Raigarh Bhopal-2 ... (8 Replies)
Discussion started by: pravani1
8 Replies

7. Shell Programming and Scripting

How to implement this?

hi i have a file like 1,"A","B" 2,"C","D" 1,"E","F" 3,"G","H" in output i need like 3,"G","H" 1,"E","F" 2,"C","D" 1,"A","B" (12 Replies)
Discussion started by: angel12345
12 Replies

8. Shell Programming and Scripting

How to implement scenario?

hi, i am having three files which is having following data file1: field1 field2 field3 1 A B 2 C D 3 E F file2: 4 G H 1 I J 5 K L file3: 4 M N (3 Replies)
Discussion started by: angel12345
3 Replies

9. Programming

Implement ps command in C

Hello, could anybody explain how the ps command works? I know something about the proc file system. But I'm still not sure about how it exactly works. Like ps without any option will print out the current user's processes, but it never displays my web browsers such as firefox or my LibreOffice... (3 Replies)
Discussion started by: freedombird9
3 Replies

10. UNIX for Dummies Questions & Answers

Implement the '&&' function in a shell

Hello, I'm currently implementing the && function in a shell using C. For example, if we input cmd1 && cmd2, then cmd2 executes only when cmd1 exits successfully. I'm thinking about: int main() { int i; char **args; while(1) { printf("yongfeng's shell:~$ "); args =... (5 Replies)
Discussion started by: Yongfeng
5 Replies
getusershell(3) 					     Library Functions Manual						   getusershell(3)

NAME
getusershell, getusershell_r, setusershell, setusershell_r, endusershell, endusershell_r - Get the names of legal user shells LIBRARY
Standard C Library (libc.a) SYNOPSIS
char *getusershell(void); int setusershell(void); int endusershell(void); The following obsolete functions are supported in order to maintain backward compatibility with previous versions of the operating system. You should not use them in new designs. int getusershell_r( char *shell, int len unsigned int *state); int setusershell_r( unsigned int *state); int endusershell_r( unsigned int *state); PARAMETERS
Points to a buffer for the shell name. Specifies the length of the shell parameter. Points to a variable which stores information about the contents of the /etc/shells file. DESCRIPTION
The getusershell() function returns a pointer to a string that contains the name of a legal user shell as defined by the system manager in the /etc/shells file. If the /etc/shells file does not exist, the standard system shells are returned. On subsequent calls, the getusershell() function returns the next shell. The endusershell() function resets the list so that subsequent calls of getusershell() reread the list from /etc/shells. The setusershell() function rereads the list from /etc/shells and subsequent calls of getusershell() start from the beginning. NOTES
The getusershell() function returns a pointer to thread-specific data. Subsequent calls to the function from the same thread overwrite this data. The getusershell_r(), setusershell_r(), and endusershell_r() functions are obsolete reentrant versions of the getusershell(), setuser- shell(), and endusershell() functions. They are supported in order to maintain backward compatibility with previous versions of the oper- ating system and should not be used in new designs. Note that you must initialize the state parameter to 0 (zero) before its first access by any of these functions. RETURN VALUES
Upon successful completion, the getusershell() function returns a pointer to a character string. If it fails or reaches the end of the shell file, it returns a null pointer. Upon successful completion, the getusershell_r() function stores a pointer to the shell name in shell and returns a value of 0 (zero). Upon failure, it returns a value of -1 and places an appropriate value in the errno variable. Upon successful completion, the setusershell_r() function returns a value of 0 (zero). Upon failure, it returns a value of -1 and places an appropriate value in the errno variable. The endusershell_r() function always returns a value of 0 (zero). ERRORS
If any of the following conditions occurs, the getusershell_r() function sets errno to the corresponding value: Either the shell parameter is invalid, the len parameter is too small, or the state parameter is a null pointer. The end of the shell list has been reached (EOF). If the following condition occurs, the setusershell_r() function sets errno to the corresponding value: Unable to allocate memory for the reread list of shells. FILES
Contains the names of legal user shells. RELATED INFORMATION
Files: shells(4). delim off getusershell(3)
All times are GMT -4. The time now is 06:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy