Vi issue with solaris


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Vi issue with solaris

I'm facing a peculiar issue when using vi on solaris. When i open a file using vi & search for a string pattern & if that pattern is not found & if i exit, vi exits with return value 1. (Checked the return value with 'echo $?' ).
When the string is found, vi exits with return value 0.

This however is not an issue with vim on solaris.
Also, vi does not show this behavior on other ( e.g. rhel, suse) setups.

Anybody can help me regarding this issue ???Smilie
# 2  
Why does it matter what vi's return value is? Is it part of a script?
# 3  
Yes, it is a part of a script ....
# 4  
I would choose sed or ex in a script. The vi is too screen oriented for script life, unless you are into firing your optical neurons a lot, usually not a cash deliverable.

Do you need to know what happened inside vi using the $? 0/1 behavior?

BTW, I have a vi wrapper I call vix:
  • for (some) xterms, it saves my scroll history: drives the on screen text up by screen size lines, then calls vi
  • for ksh command editing, set -o vi/viraw, export $EDITOR=~/bin/vix: always returns 0 so my output is not discarded by ksh.
Code:
#!/usr/bin/ksh

(
 stty -a | sed '
        s/^/ /
        t a
        :a
        s/.* rows = \([1-9][0-9]*\).*/\1/
        t
        d
        ' | read zr

# echo $zr >&2

 if [ "$zr" = "" ]
 then
  zr=25
 fi

 while [ "$zr" != -1 ]
 do
  zr=$(( $zr - 1 ))
  echo >/dev/tty
  done

 vi "$@"

 exit 0
)

# 5  
same here too

Interesting. You didn't mention the bigger picture of what you are trying to do, but maybe you would be better off using grep to see if a string exists in a file, or sed if you need to change that string?
# 6  
Tell us what the vi part does for your data.
# 7  
Quote:
Originally Posted by pj87
I'm facing a peculiar issue when using vi on solaris. When i open a file using vi & search for a string pattern & if that pattern is not found & if i exit, vi exits with return value 1. (Checked the return value with 'echo $?' ).
When the string is found, vi exits with return value 0.

This however is not an issue with vim on solaris.
Also, vi does not show this behavior on other ( e.g. rhel, suse) setups.

Anybody can help me regarding this issue ???Smilie
It can be argued this is actually a vim non conformance and Solaris vi is behaving correctly by sticking to the POSIX specification (vi) which states:
Code:
EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred.

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Science: Mathematics
Difficulty: Hard
If you could fold a piece of paper in half 50 times, its' thickness will be 3/4th the distance from the Earth to the Sun.
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

Solaris 8 postfix issue

Hey Guys, I've got a question about the which command in Solaris 8. the command which postfix says that postfix is linked to /usr/local/sbin/postfix in other system postfix is linked to /opt/csw/sbin/postfix How can ich change the first one to the scond one? Kind Regards (0 Replies)
Discussion started by: Marcusg562
0 Replies

2. UNIX for Dummies Questions & Answers

grep issue (Solaris)

Can anyone explain this (i.e. why the 2nd grep does not find anything)?: -bash-3.00$ cat tmp.log sftp> chdir /home/test-dir sftp> mget thosefiles*.txt File "/home/test-dir/thosefiles*.txt" not found. -bash-3.00$ grep "s*.txt" tmp.log sftp> mget thosefiles*.txt File... (4 Replies)
Discussion started by: dhebden
4 Replies

3. Solaris

issue on solaris installation

hi Guys.. i''m new to solaris, i got some issue during solaris installation, it asking there is no space for it ... required space is 756mb but available is 324mb ..... (dell plade server ...) can any one tell me how to resolve and install OS on machine ... plz tell me it urgent ... (9 Replies)
Discussion started by: coolboys
9 Replies

4. Solaris

sendmail issue on solaris 9

We changed relay agent in sendmail.cf and submit.cf files, and restarted the send mail services from init.d, able to see the sendmail processes. But unable to send an email. Relay agent is telnetable with port 25. Please help us with the issue (2 Replies)
Discussion started by: sudhakar110
2 Replies

5. Solaris

Issue after jumpstart with Solaris 10 u7

I am performing this installation on a Sun T5220. There is an aftermarket Adaptec StorageTek raid controller card installed. I have created the raid array, and it is referred to as c1t0d0. Here is the profile I have created: install_type initial_install system_type server cluster SUNWCXall... (4 Replies)
Discussion started by: msarro
4 Replies

6. Solaris

Printing Issue On Solaris 10

Synopsis: Solaris 10 SunFire v880 with two networked HP laser printers set up through HPPI. Test page will print through HPPI but can't print to them us the lp command. When using the lp command it just hangs and causes the Samba process to fail. We have a SunFire v880 running Solaris 10. $$... (1 Reply)
Discussion started by: KenLynch
1 Replies

7. Solaris

du -sh issue in solaris 10

i have 30 file systems on my production system and my system is responding too slow and / is 99% full is there any way i can run the du -sh only on root file systems and skip all the SAN file systems as the system is unable to do du -sdh * / as it would try to run du on all the SAN/NAS file... (5 Replies)
Discussion started by: fugitive
5 Replies

8. Solaris

Solaris Issue

Hi, I am having a serious problem with a Solaris 2.6 box. Whenever I try and tar a large directory I get this error:tar: write error: unexpected EOF My own research shows that I might have to enable tarring large files by this command: fsadm -o largefiles <mountpoint> My box does not... (8 Replies)
Discussion started by: mojoman
8 Replies

9. Solaris

ScreenSaver issue with Solaris 10

I have a Dell Vostro running Solaris 10 x86 and I am trying to get it to activate the screensaver when no one is logged it. However, the screensaver only seems to activate when someone logs in and then the computer locks. How would I go about fixing this problem? Any help yall can offer would be... (3 Replies)
Discussion started by: MajorJRO
3 Replies

10. UNIX for Advanced & Expert Users

Solaris 10 auth issue

Very strange one, we've got a recently build server (Sol10 via JET flash). Bascially you can ssh to it fine, but telnet will allow entry of username, but will then feed in a carriage return on the passwd field, this also happens on any auth type command, ie passwd on a user account will also... (4 Replies)
Discussion started by: itsupplies
4 Replies

Featured Tech Videos