08-24-2015
Hi, Scrutinizer.
Agreed for that specific task, hence the caveat in item 1, and suggestion 3 to elicit the real reason ... cheers, drl
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi folks,
Need your help.
I am writing a KSH script to read a few commands from a file & execute.
I am using the following code to read the file line by line & excute each command. When I am printing each line I see it is printing properly but while excuting, the particular "ps" command... (5 Replies)
Discussion started by: tipsy
5 Replies
2. Shell Programming and Scripting
Hi All
I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh
URL="www.google.com"
VBURL="10.5.2.211"
echo "Setting route for $URL for GPRS"
URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1`
echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies
3. Shell Programming and Scripting
Please help with this simple example. I can not figure out how to do it. A file named “job” contains only this one line:var=5I need a script to read the job file and execute it as a command. This is my attempt (it does not work):#!/bin/sh
exec < job
echo "var = $var"output should read “var = 5”... (5 Replies)
Discussion started by: wolfv
5 Replies
4. Linux
Hi Gurus ,
I hope you are doing great .
Other than owner of the file , OTHERS and GROUP should be restricted from read or write a file created by the owner.
OTHERS and GROUP should be only allowed to execute the file.
Thanks in advance. (8 Replies)
Discussion started by: palanisvr
8 Replies
5. Shell Programming and Scripting
Hello, I am quite new in shell scripting and I would like to write a little scritp to run a program on some parameters files.
all my parameters files are in the same directory, so pick them up with
ls *.para >>dirafter that I have a dir file like that:
param1.para
param2.para
etc...
I... (2 Replies)
Discussion started by: shadok
2 Replies
6. Shell Programming and Scripting
Hi
I am new to writing script and want to use a Bash Piped while-read and read from user input.
if something happens on server.log then do while loop or if something happend on user input then do while loop.
Pseudocode something like:
tail -n 3 -f server.log | while read serverline || read... (8 Replies)
Discussion started by: MyMorris
8 Replies
7. Shell Programming and Scripting
hello,
I have prepared a script
------------------------------------------------
#!/bin/sh
cat test.txt| sed '1d' | sed '$d' > /tmp/tmp1.txt
while read line
do
typeset -i count=`echo $line | tr ' ' '}' | wc -c`
finalcount=`expr $count - 1`
echo $finalcount
done <... (12 Replies)
Discussion started by: rac
12 Replies
8. Shell Programming and Scripting
Hi,
can some one help me how to encrypt and decrypt a file.
AIM: reade user input, encrypt it and save it to file.
while decryption read the encrypted file decrypt it and save the output in some variable.
Example: consider we have Credentials.txt file with content username: password... (5 Replies)
Discussion started by: saichand1985
5 Replies
9. Shell Programming and Scripting
Hi,
I am facing issues with the below:
I have a lookup file say lookup.lkp.This lookup.lkp file contains strings delimited by comma(,).
Now i want to read this command from file and execute it.
So my code below is :
Contents in the lookup.lkp file is :
c_e,m,a,`cd $BOX | ls cef_*|tail... (7 Replies)
Discussion started by: vital_parsley
7 Replies
10. Shell Programming and Scripting
I need to develop a process/daemon which will constantly monitor a file for new entry and execute a command.
for eg, there is a file /var/log/inotify.log
When a new entry like below gets appeneded to this file, execute the command as follows.
/home/user/public_html/bad.php|CREATE
... (2 Replies)
Discussion started by: anil510
2 Replies
CHMOD(2) System Calls Manual CHMOD(2)
NAME
chmod - change mode of file
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
int chmod(const char *path, mode_t mode)
DESCRIPTION
The file whose name is given by path has its mode changed to mode. Modes are constructed by or'ing together some combination of the fol-
lowing, defined in <sys/stat.h>:
S_ISUID 04000 set user ID on execution
S_ISGID 02000 set group ID on execution
S_ISVTX 01000 `sticky bit' (see below)
S_IRWXU 00700 read, write, execute by owner
S_IRUSR 00400 read by owner
S_IWUSR 00200 write by owner
S_IXUSR 00100 execute (search on directory) by owner
S_IRWXG 00070 read, write, execute by group
S_IRGRP 00040 read by group
S_IWGRP 00020 write by group
S_IXGRP 00010 execute (search on directory) by group
S_IRWXO 00007 read, write, execute by others
S_IROTH 00004 read by others
S_IWOTH 00002 write by others
S_IXOTH 00001 execute (search on directory) by others
If mode ISVTX (the `sticky bit') is set on a directory, an unprivileged user may not delete or rename files of other users in that direc-
tory. (Minix-vmd)
Only the owner of a file (or the super-user) may change the mode.
Writing or changing the owner of a file turns off the set-user-id and set-group-id bits unless the user is the super-user. This makes the
system somewhat more secure by protecting set-user-id (set-group-id) files from remaining set-user-id (set-group-id) if they are modified,
at the expense of a degree of compatibility.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
Chmod will fail and the file mode will be unchanged if:
[ENOTDIR] A component of the path prefix is not a directory.
[ENAMETOOLONG] The path name exceeds PATH_MAX characters.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path prefix.
[ELOOP] Too many symbolic links were encountered in translating the pathname. (Minix-vmd)
[EPERM] The effective user ID does not match the owner of the file and the effective user ID is not the super-user.
[EROFS] The named file resides on a read-only file system.
[EFAULT] Path points outside the process's allocated address space.
[EIO] An I/O error occurred while reading from or writing to the file system.
SEE ALSO
chmod(1), open(2), chown(2), stat(2).
NOTES
The sticky bit was historically used to lock important executables into memory.
4th Berkeley Distribution May 13, 1986 CHMOD(2)