473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

vi editor eating away at my chars, namely #! in UNIX

Dököll
2,364 Expert 2GB
Not sure how to post this, I'll just come out with it gang...

I ran into some trouble loading certain commands using an editor called "pico editor". All was working fine and suddenly stopped responding to my commands which I'll post in a bit; which contained the characters mentioned above...

So I thought okay I'll try another editor, lo and behold, I cannot run the code there either because this editor does not like me adding #!/bin/sh, and has deleted these chars rendering the code virtually unusable.

Is there a command I need to add in order for the vi editor to accept #! in the code. pico is not working and I have since driven to the college just case it was my network, same treatement there:

Expand|Select|Wrap|Line Numbers
  1. #!/bin/sh                 
  2. #sample shell using the if                                                                            
  3. echo "Let's create a fancy directory"                                          
  4. if [ -d unixbackup ]
  5. then
  6.         echo "directory unixbackup exists"
  7. else
  8.         echo "Looks like directory unixbackup does not exist"
  9.         echo "Would you like to create it now? (y/n)"
  10.         read x
  11.         echo $x
  12.         if [ $x = "y" ]
  13.         then
  14.                 mkdir unixbackup
  15.                 echo "Super! unixbackup directory has been created"
  16.         else
  17.                 echo "Sorry! unixbackup directory has not been created"
  18.         fi
  19. fi
  20.  
It's nothing fancy but if I could run it through the vi editor, it would be great.
What are your thoughts?

Thanks!

Dököll
Feb 17 '08 #1
5 2400
numberwhun
3,509 Expert Mod 2GB
Not sure how to post this, I'll just come out with it gang...

I ran into some trouble loading certain commands using an editor called "pico editor". All was working fine and suddenly stopped responding to my commands which I'll post in a bit; which contained the characters mentioned above...

So I thought okay I'll try another editor, lo and behold, I cannot run the code there either because this editor does not like me adding #!/bin/sh, and has deleted these chars rendering the code virtually unusable.

Is there a command I need to add in order for the vi editor to accept #! in the code. pico is not working and I have since driven to the college just case it was my network, same treatement there:

Expand|Select|Wrap|Line Numbers
  1. #!/bin/sh                 
  2. #sample shell using the if                                                                            
  3. echo "Let's create a fancy directory"                                          
  4. if [ -d unixbackup ]
  5. then
  6.         echo "directory unixbackup exists"
  7. else
  8.         echo "Looks like directory unixbackup does not exist"
  9.         echo "Would you like to create it now? (y/n)"
  10.         read x
  11.         echo $x
  12.         if [ $x = "y" ]
  13.         then
  14.                 mkdir unixbackup
  15.                 echo "Super! unixbackup directory has been created"
  16.         else
  17.                 echo "Sorry! unixbackup directory has not been created"
  18.         fi
  19. fi
  20.  
It's nothing fancy but if I could run it through the vi editor, it would be great.
What are your thoughts?

Thanks!

Dököll
I code in vi when using *nix all the time and have never had any issue where it removed text without me removing it. Just save the file after adding the text. Have you tried adding the text in vi and see if it happens. I don't see why a text editor would care what text you put into it. Unless it was placed in its command interface. In vi, if you hit escape -> : that puts you into command mode and if you enter something after the colon, then it would be interpreted as a command and not text.

Regards,

Jeff
Feb 17 '08 #2
Dököll
2,364 Expert 2GB
I code in vi when using *nix all the time and have never had any issue where it removed text without me removing it. Just save the file after adding the text. Have you tried adding the text in vi and see if it happens. I don't see why a text editor would care what text you put into it. Unless it was placed in its command interface. In vi, if you hit escape -> : that puts you into command mode and if you enter something after the colon, then it would be interpreted as a command and not text.

Regards,

Jeff
Hey Jeff, good advice!

I don't think I saved after adding the code there. Perhaps I was disoriented since pico runs a bit differently.

Will give it a whirl again, thanks Jeff!

Köll
Feb 17 '08 #3
Dököll
2,364 Expert 2GB
Hey Jeff, good advice!

I don't think I saved after adding the code there. Perhaps I was disoriented since pico runs a bit differently.

Will give it a whirl again, thanks Jeff!

Köll
By the way, Jeff...

Why would I get a "terminal too wide" type of an error? Now and then when I have a lot of code in the editor it seems to throw that message down below.

In a bit!
Feb 17 '08 #4
Dököll
2,364 Expert 2GB
By the way, Jeff...

Why would I get a "terminal too wide" type of an error? Now and then when I have a lot of code in the editor it seems to throw that message down below.

In a bit!
Please disregard the above. Looks like vi does not like the screen maximized. That's news to me.

The command now works and as mentioned vi does not delete stuff, my silly way of looking at it failed me:-)

Will be using vi more often to grab some tips.

The problem I am having now is that, I cannot remove my directory:

Expand|Select|Wrap|Line Numbers
  1. #!/bin/sh
  2. #Sample Shell to remove directory...
  3.  
  4. echo "Let's delete a fancy directory"
  5. if [ -d unixbackup ]
  6. then
  7.         echo "directory unixbackup exists"
  8.         echo "Would you like to delete it now? (y/n)"
  9.         read x
  10.         echo $x
  11.         if [ $x = "y" ]
  12.         then
  13.               rmdir  unixbackup
  14.                 echo "Super! unixbackup directory has been deleted"
  15.         else
  16.                 echo "Sorry! unixbackup directory has not been deleted"
  17.         fi
  18. fi
  19.  
After giving myself full access to a script file containing above command through SSH Secure Shell, I get a Command not found. It was working before.

I attempted to back track, just to see if I had done something like delete the script by accident, still nothing.

What do you think may be happening?

Thanks for your help!
Feb 17 '08 #5
Dököll
2,364 Expert 2GB
Please disregard the above. Looks like vi does not like the screen maximized. That's news to me.

The command now works and as mentioned vi does not delete stuff, my silly way of looking at it failed me:-)

Will be using vi more often to grab some tips.

The problem I am having now is that, I cannot remove my directory:

Expand|Select|Wrap|Line Numbers
  1. #!/bin/sh
  2. #Sample Shell to remove directory...
  3.  
  4. echo "Let's delete a fancy directory"
  5. if [ -d unixbackup ]
  6. then
  7.         echo "directory unixbackup exists"
  8.         echo "Would you like to delete it now? (y/n)"
  9.         read x
  10.         echo $x
  11.         if [ $x = "y" ]
  12.         then
  13.               rmdir  unixbackup
  14.                 echo "Super! unixbackup directory has been deleted"
  15.         else
  16.                 echo "Sorry! unixbackup directory has not been deleted"
  17.         fi
  18. fi
  19.  
After giving myself full access to a script file containing above command through SSH Secure Shell, I get a Command not found. It was working before.

I attempted to back track, just to see if I had done something like delete the script by accident, still nothing.

What do you think may be happening?

Thanks for your help!
About this problem!

Well, I must be losing my marbles but I deleted my .cshrc and .longin files after making copies of them.

All is well now:-)
Feb 22 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jason Tesser | last post by:
What is the best overall ide studio that can be used to develop crossplatform apps (win,linux,mac) for python? Jason Tesser Web/Multimedia Programmer Northland Ministries Inc. (715)324-6900...
36
by: ChinStrap | last post by:
When not using the interactive prompt, what are you using? I keep hearing everyone say Emacs, but I can't understand it at all. I keep trying to learn and understand why so many seem to like it...
14
by: SD | last post by:
I am thinking about writing a text editor in C for unix sometime soon. I am just doing this to learn more about C. I want to write something like ed.c, a simple line editor. What types of data...
24
by: Desmond Cassidy | last post by:
Hi, I don't know whether this is the correct place to ask this question..anyway here goes... I have a large solution with about 300 .vb files split into 9 projects VB.net Framework 1.1 WinXP...
1
by: google | last post by:
Hello all- Apologies to everyone for what's probably a very inchoate and uninformed question, but I've been thrust into the position about having to learn more about PHP very quickly. (I'm also...
63
by: John Salerno | last post by:
I know there's a request for a good IDE at least once a week on the ng, but hopefully this question is a little different. I'm looking for suggestions for a good cross-platform text editor (which...
19
by: saurabh.ss | last post by:
I want a C++ editor for Linux that resembles Microsoft Visual Studio's integrated editor. I mean it should have features like auto-completion, auto-indentation and syntax highlighting. Also it...
12
by: sid | last post by:
Hi! I am sorry that I am asking a little off topic question, but I am sure some of you can surely help me. I am writiing a VI like text editor in C++ for the console. I would like to know some...
3
by: Hallvard B Furuseth | last post by:
I wrote: Okay, I've seriously miscommuniated here... If I do this, I'll reformat the code to what will become the project's new style, and commit the results. Assuming it gets OKed. When...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.