03-16-2010
That's because cd isn't a program, but a shell-builtin. Always. It wouldn't be useful as a standalone utility, as it can't change the working directory of any other program.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
cat .servers | while read LINE; do
ssh jason@$LINE $1
done
exit 1
./command.ksh "ls -l ~jason"
Why does this ONLY iterate on the first server in the list? It's not doing the command on all the servers in the list, what am I missing?
Thanks!
JP (2 Replies)
Discussion started by: jpeery
2 Replies
2. UNIX for Dummies Questions & Answers
Howdie everyone...
I have a shell script RemoveFiles.sh
Inside this file, it only has two commands as below:
rm -f ../../reportToday/temp/*
rm -f ../../report/*
My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies
3. Shell Programming and Scripting
Hello, the ls -d command to only list directories in a directory doesn't seem to work on Solaris and the man command says to use that combination: ls -d
Anyone have the same problem and find a resolve?
Thanks
BobK (9 Replies)
Discussion started by: bobk544
9 Replies
4. Shell Programming and Scripting
i want to get the value for column 4rth when i =4. please guide what i am doing wrong. thanks
var=`cat file.csv`
for i in $var; do {
if ; then
var4=$var4+$i
fi
echo $i
}
done
I am geting this error message "0403-009 The specified number is not valid for this command." (8 Replies)
Discussion started by: sagii
8 Replies
5. Shell Programming and Scripting
Hi,when I run my first shell script,I got something that doesn't work right.
I wrote this code in the script.
echo -e "Hello,World\a\n"But the screen print like this:
-e Hello,World
The "-e" wasn't supposed to be printed out.
Can anyone help me out?:wall:
Many thanks!:) (25 Replies)
Discussion started by: Demon
25 Replies
6. Shell Programming and Scripting
I have the following and for some reason I can't have two options together.
I mean if I choose -u and -p it won't work... why?
#!/bin/bash
resetTime=1
mytotalTime=0
totalHour=0
totalMin=0
averagemem=0
finalaverage=0
times=0
function usage()
{
cat << EOF
USAGE: $0 file
EOF
} (10 Replies)
Discussion started by: bashily
10 Replies
7. UNIX for Dummies Questions & Answers
find . -name "05_scripts" -type d -exec mv -f {}/'*.aep\ Logs' {}/.LogFiles \;
Returns this failure:
mv: rename ./019_0120_WS_WH_gate_insideTEST/05_scripts/*.aep\ Logs to ./019_0120_WS_WH_gate_insideTEST/05_scripts/.LogFiles/*.aep\ Logs: No such file or directory
I don't know why it's trying... (4 Replies)
Discussion started by: scribling
4 Replies
8. HP-UX
I edited sudoers like this:vi /etc/sudoers
subex ALL =(root) NOPASSWD: /usr/ccs/bin/pstack
But the respective user still is prompted for password, and even when the right password is used, the command is still not launched.$sudo usr/ccs/bin/pstack 26557
We trust you have received the usual... (5 Replies)
Discussion started by: black_fender
5 Replies
9. Shell Programming and Scripting
Hi,
I am using korn shell.
until ]
do
echo "\$# = " $#
echo "$1"
shift
done
To the above script, I passed 2 parameters and the program control doesn't enter inside "until" loop. If I change it to until ] then it does work.
Why numeric comparison is not working with -ne and works... (3 Replies)
Discussion started by: ab_2010
3 Replies
10. Shell Programming and Scripting
Hi
tail -f $PROGPATH/NBU_pgbaserestore_$1.log | while read LOGLINE
do
if ] && ! ]
then
date "+%d.%B.%Y %H:%M:%S"
echo "ERROR: NBU"
echo "$LOGLINE"
TAILKILL=$(pgrep -P $$ -x tail)
kill -9 $TAILKILL
exit 1
... (3 Replies)
Discussion started by: kvaikla
3 Replies
cd(1) General Commands Manual cd(1)
NAME
cd - change working directory
SYNOPSIS
[directory]
DESCRIPTION
If directory is not specified, the value of shell parameter is used as the new working directory. If directory specifies a complete path
starting with or directory becomes the new working directory. If neither case applies, tries to find the designated directory relative to
one of the paths specified by the shell variable. has the same syntax as, and similar semantics to, the shell variable. must have execute
(search) permission in directory.
exists only as a shell built-in command because a new process is created whenever a command is executed, making useless if written and pro-
cessed as a normal system command. Moreover, different shells provide different implementations of as a built-in utility. Features of as
described here may not be supported by all the shells. Refer to individual shell manual entries for differences.
If is called in a subshell or a separate utility execution environment such as:
(which invokes on accessible directories) does not affect the current directory of the caller's environment. Another usage of as a stand-
alone command is to obtain the exit status of the command.
EXTERNAL INFLUENCES
International Code Set Support
Single- and multi-byte character code sets are supported.
Environment Variables
The following environment variables affect the execution of
The name of the home directory,
used when no directory operand is specified.
A colon-separated list of pathnames that refer to directories.
If the directory operand does not begin with a slash character, and the first component is not dot or dot-dot, searches
for directory relative to each directory named in the variable, in the order listed. The new working directory is set
to the first matching directory found. An empty string in place of a directory pathname represents the current direc-
tory. If is not set, it is treated as if it was an empty string.
EXAMPLES
Change the current working directory to the directory from any location in the file system:
Change to new current working directory residing in the current directory:
or
Change to directory residing in the current directory's parent directory:
Change to the directory whose absolute pathname is
Change to the directory relative to home directory:
RETURN VALUE
Upon completion, exits with one of the following values:
The directory was successfully changed.
An error occurred. The working directory remains unchanged.
SEE ALSO
csh(1), pwd(1), ksh(1), sh-posix(1), sh(1), chdir(2).
STANDARDS CONFORMANCE
cd(1)