Sponsored Content
Full Discussion: Vi editor in UNIX hwk HELP!!
Homework and Emergencies Homework & Coursework Questions Vi editor in UNIX hwk HELP!! Post 302801291 by bcute92 on Wednesday 1st of May 2013 07:32:44 PM
Old 05-01-2013
Vi editor in UNIX hwk HELP!!

i need help with this homework. PLEASE

Assignment:
Create a directory "preFinal" in your home directory. Create empty files "a", "b", "c", etc in directory preFinal in the amount that match the number of directories preFinal*

This the code i have within Vi editor. But it is not working all the way. After runing bash about 10 times the letters jump from i to a random number and not in abc order. PLEASE TELL me how to do this.
Code:
#!/bin/bash

dir="preFinal"

if [ -d $dir ]; then
       echo "dir exists, moving..."
       i=0
       for dir_bkp in `ls -lrt | grep "^d" | egrep "preFinal*" | awk '{print $NF}' | sort -nr`; do
               next=$(echo "$dir_bkp" | sed 's/^.*\.//')
               if [ $next == "preFinal" ]; then
                       next=-1
               fi
               next=`echo $next|sed 's/^0*//'`
               ((next++))
               next=$(printf "%03d" $next)
               #next="00$next"
               echo $next
               mv $dir_bkp $dir.$next
               ((i++))

else
       mkdir $dir
       touch $dir/a
fi

Bre/ GSW university / Unix CIS 3200 / Simon

Last edited by bcute92; 05-01-2013 at 09:51 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unix vi editor

Dear All, Is there a way to handle special french, spanish character is vi editor (Sun Solaris 8). Foll. is a label in notepad (windows), Cliquez ici pour revenir Ã_ la recherche de l'hôtel this label is stored in a text file, when i tranfer this file to unix using ftp (tried both ansi & bin... (6 Replies)
Discussion started by: lloydnwo
6 Replies

2. Shell Programming and Scripting

how to make VI editor show colors in Unix

Hi, I saw some people's vi editor show different colors on the text according the nature of text when using it. It would be nice if I can see diffrerent colors with my vi editor. Do anybody know how to set it up? I use PowerTermPro program to access unix machine. I tried to use vim editor but... (7 Replies)
Discussion started by: whatisthis
7 Replies

3. Shell Programming and Scripting

Using Unix screen cmd effecting Vi editor

Hello, I enjoy using the unix screen utility, but my vi sessions lose the ability to syntax highlight code and split screen(:vs or :sp). When not using screen, I can do those things within vi. Anybody experience this and know the fix? Thanks (1 Reply)
Discussion started by: geephei
1 Replies

4. Shell Programming and Scripting

set EDITOR=vi -> default editor not setting for cron tab

Hi All, I am running a script , working very fine on cmd prompt. The problem is that when I open do crontab -e even after setting editor to vi by set EDITOR=vi it does not open a vi editor , rather it do as below..... ///////////////////////////////////////////////////// $ set... (6 Replies)
Discussion started by: aarora_98
6 Replies

5. Shell Programming and Scripting

VI Editor - question for unix gurus !!

I have created a dummy file -demo.txt On my machine-A (oslevel-5300-08) I can display the file content in HEX format through VI editor using :%!xxd but on other machine-B (oslevel - 5300-06) , I get error as "sh: xxd: not found." machine-A: $ cat demo.txt Hello World ! I can display... (7 Replies)
Discussion started by: Rahulpict
7 Replies

6. UNIX for Dummies Questions & Answers

Any better text editor for unix?

Do you know any text editor (other than Gvim, which I am using) which is made specially for c type languages? The reason I ask for it is: I just spent 3 hours trying to find out start "if" and its end "if end".:wall: I hope there is an editor which can link each if with its closing endif . (4 Replies)
Discussion started by: animesharma
4 Replies

7. Shell Programming and Scripting

Copy from vi Editor ( unix ) to windows

How to copy the complete content from a file in vi Editor to windows ( notepad ). I can use " select " and paste it to windows but this is restricted to current page. Not allowing me to scroll down or up when selecting the content.:confused: (1 Reply)
Discussion started by: frintocf
1 Replies

8. HP-UX

UNIX VI editor equivalent of LINUX

Hi All, I am comfortable working in LINUX and need equivalents for HP-UX for below mentioned, 1. We use TAB key to expand/reveal a name in LINUX. Is there any way to make this work for UNIX, where it is double escape. 2. Also can we use make use of left,down,up,right keys instead... (3 Replies)
Discussion started by: pradebban
3 Replies

9. UNIX for Dummies Questions & Answers

Vi editor will not open new to UNIX. help please.

vi: syntax error at line 1: `)' unexpected when I try to vi into the /etc/vfstab, the return gives me the above error. how can resolve this so that I can have access into vi. (6 Replies)
Discussion started by: dovestar
6 Replies

10. What is on Your Mind?

What is Your Favorite Editor for Linux and UNIX? | A Video in 1080 HD

We have asked UNIX.com users over the years what is their favorite editor and why. Here is the top three answers. Here is a new YT video on this question: What Editor Does Everyone Use? https://youtu.be/gqE8RTZZt9g Of course, vi was the overwhelming favorite. Credits: 1080 HD... (3 Replies)
Discussion started by: Neo
3 Replies
BITPIM(1)						      General Commands Manual							 BITPIM(1)

NAME
bitpim - utility to communicate with many CDMA phones SYNOPSIS
bitpim [ -c file | -d dir ] [ -f model ] [ -p device ] [ bitfling ] [ debug ] [ cli-command ] DESCRIPTION
This manual page documents briefly the bitpim command. BitPim allows you to view and manipulate data on many phones from LG, Samsung, Sanyo, and other manufacturers that use Qualcomm CDMA chips. Depending on your phone model, you may be able to access the phone book, the calendar, wallpapers, ring tones, and the filesystem. OPTIONS
A summary of options is included below. -c file Read configuration from file. -d dir Read configuration from dir/.bitpim. -f model Assume a phone type of model rather than what the configuration file specifies. Particularly useful in CLI mode. -p device Communicate with the phone via the device ("port") device. bitfling Run as bitfling(1). debug Print debugging information to standard output and standard error. cli-command Interact with the phone's filesystem via a command-line interface. The command must be a single (quoted) argument, and can take any of the following forms: cli Bring up an interactive shell, allowing all of the below commands as well as a few others (cd dir, cdu, exit, and pwd or equivalently cwd). cp src [...] destdir Copy files to, from, or within the phone. ll dir [...] Print a detailed listing of the specified phone directory or directories. ls dir [...] Print a brief listing of the specified phone directory or directories. mkdir dir [...] Create a directory on the phone. rm file [...] Remove one or more files from the phone. rmdir dir [...] Remove one or more directories, which must already be empty, from the phone. Please note that none of these commands accepts wildcards. To indicate that an argument denotes a file or directory on the phone, you can prefix it with phone:; this is mainly relevant for cp, which performs phone-to-PC copies unless otherwise directed. FILES
$HOME/.bitpim-files/.bitpim The default configuration file. SEE ALSO
bitfling(1), http://www.bitpim.org/. AUTHOR
bitpim was primarily written by Roger Binns <rogerb@rogerbinns.com>. This manual page was written by Aaron M. Ucko <ucko@debian.org>, for the Debian project (but may be used by others). 2007-12-12 BITPIM(1)
All times are GMT -4. The time now is 05:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy