05-31-2008
Simple script? First timer...
Hey guys, I'm brand new to the bash scripting world, here's my issue..
When people SSH to my box, I'm wanting to use screen to monitor them if I so choose. So, I've created a new user: testing, and I've set its startup shell to /bin/myshell.sh whose contents read this:
#!/bin/sh
$me = whoami
screen -S $me
/bin/bash
This is, for some reason, locking my entire system up..
Any help is greatly appreciated, as I've no clue what the hell I'm doing here. Thanks guys!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
any of you guys have a script for measuring the run time of any given script, where you would sandwich your own script between the timer script or something? thanks! :) (2 Replies)
Discussion started by: mark_nsx
2 Replies
2. Shell Programming and Scripting
Is there a way to make a timer?
E.g Please give the seconds...
... (6 Replies)
Discussion started by: aekaramg20
6 Replies
3. Shell Programming and Scripting
Hi
I have a script that execute every X minute for checking new files in a folder and converting to pdf.
Is there any way to start this script automatically on linux startup?. I use sleep function in script with infinite loop.
while
do
killall -u `whoami` -q soffice
soffice... (0 Replies)
Discussion started by: zawmn83
0 Replies
4. UNIX for Dummies Questions & Answers
is there a timer function in unix without using C?
for example i want to display a message after 5 seconds
how do i do that? (2 Replies)
Discussion started by: khestoi
2 Replies
5. Shell Programming and Scripting
Please how can i display a 60 second active countdown timer in an echo message. (7 Replies)
Discussion started by: frankycool
7 Replies
6. Shell Programming and Scripting
So I am attempting to get a short but complex perl script to be able to time out an application that I will launch from a command line. The terminal I use is MKS C SHELL and I am having trouble doing the a job spawn that will launch the application and keep time on it.
I know you could do this... (1 Reply)
Discussion started by: vas28r13
1 Replies
7. UNIX for Dummies Questions & Answers
Hey folks,
We already got a working Script running, but actually we gotta start it manually but at least we want to run it like every 30minutes 1time.
Could anyone give it a shot?
#!/bin/sh
for i in A B C D E F G H I J K L M N O P Q R S T U V W X Z
do
ln -sv /x/$i/*/PDF/001-*.*... (1 Reply)
Discussion started by: Yjerith
1 Replies
8. Shell Programming and Scripting
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
Discussion started by: torchij
16 Replies
9. Shell Programming and Scripting
Hello Experts-
We are facing some issues in the while loop script when we use the script time to decide whether to exist from the loop or continue.
Below is the script
SrcExitLoop="FALSE"
Src_InitialStartTime=`date +%s`
Src_StartTime=`date +%s`
Src_NUM_ALERTS=0
TOTAL_ALERTS=`expr <SOME... (4 Replies)
Discussion started by: Amey Joshi
4 Replies
10. UNIX for Dummies Questions & Answers
Hi
Could somebody please help me with this code?
------------------------------------------
@ftp -i -s:"%~f0"&GOTO:EOF
open mysite.co.uk
myusername
mypassword
!:--- FTP commands below here ---
cd public_html/
binary
lcd c:\
put myfile.jpg
bye
... (3 Replies)
Discussion started by: dobbies
3 Replies
LEARN ABOUT REDHAT
system
SYSTEM(3) Linux Programmer's Manual SYSTEM(3)
NAME
system - execute a shell command
SYNOPSIS
#include <stdlib.h>
int system(const char *string);
DESCRIPTION
system() executes a command specified in string by calling /bin/sh -c string, and returns after the command has been completed. During
execution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored.
RETURN VALUE
The value returned is -1 on error (e.g. fork failed), and the return status of the command otherwise. This latter return status is in the
format specified in wait(2). Thus, the exit code of the command will be WEXITSTATUS(status). In case /bin/sh could not be executed, the
exit status will be that of a command that does exit(127).
If the value of string is NULL, system() returns nonzero if the shell is available, and zero if not.
system() does not affect the wait status of any other children.
CONFORMING TO
ANSI C, POSIX.2, BSD 4.3
NOTES
As mentioned, system() ignores SIGINT and SIGQUIT. This may make programs that call it from a loop uninterruptable, unless they take care
themselves to check the exit status of the child. E.g.
while(something) {
int ret = system("foo");
if (WIFSIGNALED(ret) &&
(WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
break;
}
Do not use system() from a program with suid or sgid privileges, because strange values for some environment variables might be used to
subvert system integrity. Use the exec(3) family of functions instead, but not execlp(3) or execvp(3). system() will not, in fact, work
properly from programs with suid or sgid privileges on systems on which /bin/sh is bash version 2, since bash 2 drops privileges on
startup. (Debian uses a modified bash which does not do this when invoked as sh.)
The check for the availability of /bin/sh is not actually performed; it is always assumed to be available. ISO C specifies the check, but
POSIX.2 specifies that the return shall always be non-zero, since a system without the shell is not conforming, and it is this that is
implemented.
It is possible for the shell command to return 127, so that code is not a sure indication that the execve() call failed.
SEE ALSO
sh(1), signal(2), wait(2), exec(3)
2001-09-23 SYSTEM(3)