10-26-2010
backtick `` means pass the result as a variable in old fashion
Using $() is new fashion (some shell implementation may not support this way to write things
This User Gave Thanks to ctsgnb For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Ih all,
i have multiples ksh scripts for crontab's unix jobs
they all have same variables declarations and some similar functions
i would have a only single script file to declare my variables, like:
var1= "aaa"
var2= "bbb"
var3= "ccc"
...
function ab { ...}
function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies
2. Shell Programming and Scripting
Hi!
I strated to script since 1 month and I don't have much expirience but this thing here is strange
I have a script where I want to store a svn command in a var to check it later
so it's like this
#!/bin/sh
list=`ssh itadmin@192.168.1.200 "ls /home/svn"` # this stores the list of... (13 Replies)
Discussion started by: ruben.rodrigues
13 Replies
3. Shell Programming and Scripting
Hi,
In the following bash code rather than cutting at a predefined character I would like to cut at position i (i var from loop).
Is this possible? I have tried eval, but either it's not possible or my syntax is wrong.
thanks
Nick
for i in {1..9}
do
theChar=$(echo... (3 Replies)
Discussion started by: de_la_espada
3 Replies
4. Shell Programming and Scripting
Hi there, In the following test, how to use shell var for pattern, regular expression. I need to accept pattern at argument, use it to pattern matching at shell script.
Test:
#!/bin/ksh
# name t.sh
exp="a@(a|b)"
touch aa ab ac
echo "\nTest without variable"
echo "---------------------"... (2 Replies)
Discussion started by: tkang007
2 Replies
5. Shell Programming and Scripting
I seem to be fighting bash's shell expansions..
I set this variable:
CMD="export MVAR=\"1 2 3\""
if I try to run it, it is clear the shell is parsing along the spaces of the contents of MYVAR:
> $CMD
+ export 'MYVAR="1' 2 '3"'
+ MYVAR='"1'
-bash: export: `2': not a valid identifier... (3 Replies)
Discussion started by: bbw
3 Replies
6. Shell Programming and Scripting
Anyone knows why the following function does not work in ksh (it does in bash)?
var() # Displays var value; case insensitive
{
_var="$1"
if ; then
echo ${!_var}
else
_var=$(echo "$_var" | tr 'a-z' 'A-Z')
echo ${!_var}
fi
unset _var
}$ var home
ksh:... (4 Replies)
Discussion started by: victorbrca
4 Replies
7. Solaris
Hi,
Is the contents in /var/log/syslog and /var/adm/messages are same??
Regards (3 Replies)
Discussion started by: vks47
3 Replies
8. Shell Programming and Scripting
This works
#!/bin/ksh
FILE="file.txt"
dosumtin () {
date >> FILE
}
for i in {1..5}
do
dosumtin
done
cat $FILE
But instead of building a file, I want to do the same with a var or an array. That is, to build one that saves all 5 of the subs execution responses in a var or an... (8 Replies)
Discussion started by: popeye
8 Replies
9. Shell Programming and Scripting
i try to find way to make string concatenation in csh ( sorry this is what i have )
so i found out i can't do :
set string_buff = ""
foreach line("`cat $source_dir/$f`")
$string_buff = string_buff $line
end
how can i do string concatenation? (1 Reply)
Discussion started by: umen
1 Replies
10. Shell Programming and Scripting
Hi
I have this command, which counts number of lines in a specific file and then prints it on screen.nawk 'NF{c++}END{print "Number of GPS coordinates in file: "c}' $filename
I would like to have the output put into a variable, but can't seem to find the correct argument for it.
How do I... (3 Replies)
Discussion started by: bulleteyedk
3 Replies
CHSH(1) User Commands CHSH(1)
NAME
chsh - change login shell
SYNOPSIS
chsh [options] [LOGIN]
DESCRIPTION
The chsh command changes the user login shell. This determines the name of the user's initial login command. A normal user may only change
the login shell for her own account; the superuser may change the login shell for any account.
OPTIONS
The options which apply to the chsh command are:
-h, --help
Display help message and exit.
-R, --root CHROOT_DIR
Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.
-s, --shell SHELL
The name of the user's new login shell. Setting this field to blank causes the system to select the default login shell.
If the -s option is not selected, chsh operates in an interactive fashion, prompting the user with the current login shell. Enter the new
value to change the shell, or leave the line blank to use the current one. The current shell is displayed between a pair of [ ] marks.
NOTE
The only restriction placed on the login shell is that the command name must be listed in /etc/shells, unless the invoker is the superuser,
and then any value may be added. An account with a restricted login shell may not change her login shell. For this reason, placing /bin/rsh
in /etc/shells is discouraged since accidentally changing to a restricted shell would prevent the user from ever changing her login shell
back to its original value.
FILES
/etc/passwd
User account information.
/etc/shells
List of valid login shells.
/etc/login.defs
Shadow password suite configuration.
SEE ALSO
chfn(1), login.defs(5), passwd(5).
shadow-utils 4.1.5.1 05/25/2012 CHSH(1)