BTW ..What is ++ operator as in (( ++count )) called ?
It's known as a pre-increment operator. It means, first increment the value in count and then use it.
On the contrary, there's a post-increment operator ((count++)); which means use it first and then increment it.
It will be clear in the following example:
These 2 Users Gave Thanks to balajesuri For This Post:
Hello, Im writing a script that works by recursively going into directories with find. But I have some directories that have spaces in them.. so I need to parse the variables to add a backslash before the spaces.
Im not exactly sure how how to do this in bash, and honestly I dont think I know... (3 Replies)
I'm trying to run a Linux virus scan on a list of files/folders I have ported to list.txt in a format:
some file with spaces
some other file
but I need to feed my scanning script in the format:
some\ file\ with\ spaces/
some\ other\ file/
so I would like to read in list.txt and output... (6 Replies)
Hello dear community!
I've recently written a BASH function for auto completion of options. It works like following: if a user types a command and then an argument to this command which starts with "^-" and then presses TAB, then 'user_command --help (or -h)' is invoked and possible options are... (0 Replies)
Hey all,
I have a very simple regular expression that I use when I want to allow only letters with spaces. (I know this regex has a lot of shortcomings, but I'm still trying to learn them)
isAlpha='^*$'However, when I bring this over to BASH it doesn't allow me to enter spaces.
I use the... (3 Replies)
Hello!
I have one problem with my bash script - I would like to be able to read white space characters from stdin (for example single " ") - can I acomplish that somehow? I need to read only one character at the time, so I use read -s -n 1 var but it doesn't work for whitespaces apparently.
... (3 Replies)
There's a JavaScript file that I call from command line (there's a framework) like so:
./RunDiag.js param1:'string one here' param2:'string two here'
I have a shell script where I invoke the above command. I can run it in a script as simple as this
#!/bin/bash
stuff="./RunDiag.js... (4 Replies)
Hi guys, I'm new here and new to shell scripting so don't be hard on me
I'm trying to create a bash script to restart a process by name in Mac OSX.
I have no problem killing the application, the problem comes when launching it again.
I managed to store the path in a variable lets say
... (8 Replies)
I'm trying to search for all files in directory with particular GID then change the GID to match the UID of each file:
#!/bin/sh
for i in $(find /dump -gid 200 | sed 's/\ /\\\ /g' | sed 's/\&/\\\&/g'); do
chgrp $(ls -ln ${i} | awk '{print $3}') ${i}
done
I'm using sed to deal with... (7 Replies)
For the record, I already tried telling mgmt and the users to disallow spaces in filenames for this script, but it isn't happening for a number of ID10T-error-based reasons.
I have simple list of 3 files in a directory that are named like this:
bash-3.2$ ls -1 file*
file1
file1 part2... (2 Replies)
Hi everyone,
I'm trying to write my first ever shell script, the OS is Raspbian. The code I have written must be executed whenever a certain database has been modified. The database resides on a Windows server to which I have a mount point, and I have no control over the Windows server at all so... (2 Replies)
Discussion started by: gjws
2 Replies
LEARN ABOUT OPENDARWIN
innetgr
innetgr(1) NSS utilities innetgr(1)NAME
innetgr - Check netgroup membership
SYNTAX
innetgr [-d domain] [-h host] [-u user] [-v] <netgroup>
DESCRIPTION
innetgr checks if the specified user, host or domain is a member of the given netgroup. The program does not produce any output unless the
verbose ( -v ) flag is given.
The exit status is 0 if the user/host/doman combination is a member of the given netgroup. Exit status is 1 if the combination is not
found in the group, and 2 if one of the arguments are invalid.
OPTIONS --domain <domain> | -d <domain>
Search in the given domain.
--host <host name> | -h <host name>
Search for the given host name.
--user <user name> | -u <user name>
Search for the given user name.
--verbose | -v
Enable verbose mode
--version | -V
Show version information.
EXAMPLES
To check if the current host is listed in the netgroup allhosts, use this command line:
if innetgr -h `uname -n` allhosts ; then echo "Found"; fi
CONFORMING TO
A innetgr program first appeared in NetBSD 1.4.
AUTHORS
Petter Reinholdtsen <pere@hungry.com>
SEE ALSO getent(1)netgroup(1)innetgr(3)netgroup(5)nsswitch.conf(5)Petter Reinholdtsen 0.7 innetgr(1)