Sponsored Content
Full Discussion: Problem with PATH
Top Forums Shell Programming and Scripting Problem with PATH Post 303020762 by MadeInGermany on Friday 27th of July 2018 02:00:52 AM
Old 07-27-2018
which is from the csh.
The standard shell has type.
The ksh in SysV introduced whence.

I think the wrapper should cover all arguments
Code:
for f
do
  [ -s "$f" ] && cp "$f" "$f.bak" && echo "created $f.bak"
done
/usr/bin/vi "$@"
for f
do
  [ -f "$f.bak" ] && rm "$f.bak" && echo "removed $f.bak"
done

Unlike $* the "$@" can handle arguments with spaces. Some early shells have a bug, AFAIR the work-around was "${1+$@}"
Code:
vi "file name with spaces"

Last but not least, I think the best backup is built into vi and vi -r is a good recovery.
This User Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PATH variable problem

root->echo $PATH /usr/ccs/bin:/opt/sfw/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin root->find / -name gcc /usr/local/bin/gcc /usr/local/doc/gcc root->which gcc no gcc in /usr/sbin /usr/bin Why cant it find gcc - the path looks okay doesnt it? I am running solaris 9 - and... (7 Replies)
Discussion started by: frustrated1
7 Replies

2. UNIX for Dummies Questions & Answers

cc path problem - no acceptable path found

Hello everyone, I'm a unix noob. I have a powerbook running mac os x 10.4 and for one of my classes I need to install the latest version of php (5.0.5). I'm following the instructions at http://developer.apple.com/internet/opensource/php.html to install but I've run into a problem. The... (2 Replies)
Discussion started by: kendokendokendo
2 Replies

3. Shell Programming and Scripting

path problem

hi , i have written csh script i am unable to set PATH variable in my script. my script is like this ===================================== # ! /bin/csh -f setenv PATH "$PATH:/opt/terascan/bin" ls -l > list lspass > pas peekauto > schedule \ num_days = 1 \ exit 0... (1 Reply)
Discussion started by: rajan_ka1
1 Replies

4. UNIX for Advanced & Expert Users

path problem

Hi i am writing a script containing processing commands which are reside in /opt/terascan/bin dir. if i run the script from command prompt it is working fine. but in crontab it is not working. if i give env command from command prompt it is showing /opt/terascan/bin dir in PATH variable. ... (10 Replies)
Discussion started by: rajan_ka1
10 Replies

5. Shell Programming and Scripting

Problem with File path

How to pass a file path to open a file? I am using cygwin. I want to open a file from a particular path, say C:\Test\File1,. This file path is stored in a variable. I am able to cat a file like this : cat "c:\Test\File1" but i want the same thing to happen in my script file through a variable... (3 Replies)
Discussion started by: sandeep_hi
3 Replies

6. Solaris

Problem Setting $PATH

I am trying to install the pkg-get package to a fresh install of Solaris 10. I am able to download and install correctly using the default directory for both pkg-get and wget as found on blastwave.org. When I issue the command "which wget and which pkg-get" it returns no wget or pkg-get found in... (1 Reply)
Discussion started by: greengrass
1 Replies

7. Infrastructure Monitoring

Problem with PATH

On one of the machines at work, we had Net-SNMP 5.2.3 installed, and I wanted to upgrade that to 5.4.2.1. So I downloaded the tar file, extracted it, did the configure, make, make test, make install, and everything worked. All the executable files (like snmpget, snmpset, snmpwalk) got copied to... (1 Reply)
Discussion started by: sllinux
1 Replies

8. Shell Programming and Scripting

if PATH contains a certain string problem!

Hi I am using MKS Toolkit c shell. I want to basically check if my PATH variable already contains a certain path directory so I tried this (it didnt work!): if: Expression Syntax if ( echo $path |grep -c c:/PROGRA~1/blah/blah ) then please help me get this little statement to work. ... (3 Replies)
Discussion started by: vas28r13
3 Replies

9. Shell Programming and Scripting

Problem with spaces in the path

Hi all, I have a variable test has the following value assigned.. could you please help on doing cd or ls to the value in the varible ... $echo $test /bdm/sdd/compounds/AD4833XT/requests/clin/Watson_20090420/docs/MHRA\ Comments\ \&\ Responses $cd $test ksh: cd: bad argument count $cd... (3 Replies)
Discussion started by: firestar
3 Replies

10. UNIX for Beginners Questions & Answers

PATH problem

For the sake of not going insane and not buggering a load of needed system stuff, I have created a dir /mybin. (This is a Debian system.) I have then edited the /etc/profile and /etc/login.defs files and added :/mybin to all of the path variables. I have the file /mybin/mtp for... (2 Replies)
Discussion started by: MuntyScrunt
2 Replies
uucleanup(1M)															     uucleanup(1M)

NAME
uucleanup - uucp spool directory clean-up SYNOPSIS
time] time] time] time] string] time] system] debug_level] DESCRIPTION
The commands, including are targeted for removal from HP-UX; see the below. scans the spool directories for old files and takes appropriate action to remove them. Depending on the options selected, performs the following: o Informs the requestor of send and/or receive requests for systems that cannot be reached. o Returns mail that cannot be delivered to the sender. o Removes all other files. In addition, warns users of requestors who have been waiting for a given number of days (the default is 1 day). Note that unless time is specifically set, the default time values for the following options are used. Options recognizes the following options: Any files greater or equal to time days old are removed with appropriate information to the requestor. The default time is 7 days. Any files greater or equal to time days old are removed. An attempt is made to deliver mail messages and execute news when appropriate. The default time is 7 days. Any files equal to time cause a message to be mailed to the requestor warning about the delay in contacting the remote. The message includes the JOBID, and in the case of mail, the mail message. The administrator can include a message line telling who to call to correct the problem (see the option). The default time is 1 day. Any files greater than or equal to time days old are removed. The files are probably not present (if they were, the could be executed). But, if files are present, they are taken care of by processing. The default time is 2 days. This string is included in the warning message generated by the option. The default string is Other files whose age is more than time days are deleted. The default time is 2 days. Clean-up the spool directory for system only. The default is to clean-up all spool directories. The debug level is a single digit between 0 and 9. The higher the numbers, the more detailed the debugging information returned. This program is typically started by the script which should be started by (see cron(1M)). WARNINGS
Use of commands, including is discouraged because they are targeted for removal from HP-UX. Use ftp(1) or rcp(1) instead. FILES
spool directory SEE ALSO
cron(1M), uucp(1), uux(1), uuclean(1M). Tim O'Reilly and Grace Todino, O'Reilly & Associates, Inc. USA. Grace Todino and Dale Dougherty, O'Reilly & Associates, Inc. USA. TO BE OBSOLETED uucleanup(1M)
All times are GMT -4. The time now is 10:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy