LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-01-2004, 03:58 AM   #1
naren
Member
 
Registered: Feb 2004
Posts: 66

Rep: Reputation: 15
Arrow pwd problem


hi!!!,

I wan't to create backup files on my system with extension ~

eg: 1.c~ for 1.c


I decided to write a shell script for the same


I name it as vim.sh

and in by .bashrc i alias it as

alias "vim =sh ~/vim.sh"



#!/bin/sh
for i in $@
do
cp $i /pwd/$i~
vim $i
done

It does not work and the error it gave without the lineno:5(vim $i)
as cannot locate directory /pwd/


What is the variable in shell which contains the present working
directory..

I think getting variable should solve the problem ..

Any ideas ..


Thanks for reading...
 
Old 04-01-2004, 04:52 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
$PWD # using variable

or

$(pwd) # using pwd-program
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
reset pwd to root's current pwd? ataraktos2 Linux - General 10 04-26-2005 04:13 AM
changed pwd tekmorph Linux - Security 5 09-15-2004 09:47 PM
pwd and the directory above sneezesnoeze Linux - Newbie 3 03-26-2004 07:18 AM
pwd Penguin666 Linux - General 1 11-19-2003 07:54 PM
usre/pwd problem while accessing RH8 samba from win 2k notorious_guy Linux - Networking 5 07-30-2003 05:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration