Simple .sh and alias or ? whatever. Do backup!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Simple .sh and alias or ? whatever. Do backup!
# 1  
Old 12-19-2015
Error Simple .sh and alias or ? whatever. Do backup!

Hi ,
Using bash shell (mintty) in cygwin/windows env. for some time and having issues with most basic commands.
Will be quite easy to get er done once I know how , just like magic tricks. I need either alias OR shell script to change windows to posix path AND put that line back -input OR .cd to that directory. The windows path is the user variable I input and eventually when I can navigate (A.U.T.O.matically) the idea will be to intergrate .find command .cp -.mv .rsync etc but I can not manipulate the right variable in order to complete? Any good pointers? flow chart looks like [start] - go here; then here; then here; -let me know where you are; then go here and [stop] Smilie. Tks in advance, newb.
Doug. Smilie
# 2  
Old 12-19-2015
Hello and welcome to the forum!


Quote:
Originally Posted by sircuts
need either alias OR shell script to change windows to posix path AND put that line back -input OR .cd to that directory.
Code:
cd /path/to/chage ; pwd ; cd $OLDPWD
# OR
pushd /path/to/change; pwd ; popd


Quote:
Originally Posted by sircuts
The windows path is the user variable I input and eventually when I can navigate (A.U.T.O.matically) the idea will be to intergrate .find command .cp -.mv .rsync etc but I can not manipulate the right variable in order to complete?
How/where do you navigate, among what, and there is no need to navigate if its done automaticly.
What shall find, cp mv and rsync do?

That is like saying:
I want a new music track, it shall contain the word girl and sexy.
It'll be the next nr #1 hit!

To go along with your flowchart:
Quote:
Originally Posted by sircuts
... [start] - go here; then here; then here; -let me know where you are; then go here and [stop]
Do that, then put that command infront of the other and voilą.
(This answer represents the info we got from your descrption)

Saying:
  1. Describe what (and how) you want to do/achieve - in 'short - detail'
  2. What have you tried so far / Where are you stuck?
  3. Code

Because, donig a backup is like asking for the favorite meal.
For each person you ask, you get a different answer, maybe two have the same, but most are different. And which of those you like too, is yet on another paper.

Last but not least, search the forum, there must be like a million threads on this topic.

Have a nice weekend.

Last edited by sea; 12-19-2015 at 01:57 PM..
This User Gave Thanks to sea For This Post:
# 3  
Old 12-20-2015
First , not being funny about anything, I know too little. I tried the code you did -
cd /path/to/chage ; pwd ; cd $OLDPWD # OR pushd /path/to/change; pwd ; popd
and can not explain what happened for instance, which popd and pushd
not in my cygwin (can add it though). Other are three seperate commands with end ";"
it ran but just seemed to echo the path which I entered?


I did :
doug@indiv-insp1520 ~
$ cd "E:\documents and settings\nero_music1\springsteen2-2" ; pwd ; cd $oldpwd
/cygdrive/e/documents and settings/nero_music1/springsteen2-2
and still in home~ dir.
similar to output from cygpath -u , the output is on screen. Now I need to pipe it back to shell somehow? Make any sense so far? And when it does add cd command and input . If I cd with wrong style path posix - bash does not like and tells me. Got to go for now , see ya.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script or alias to backup all files opened by vi

we want to backup all opened files by vi before editing also with version information. i wrote below alias to backup crontab file content with version info. What i want know is to make this opened files by vi. We want to prevent user mistakes by adding this alias. alias crontab='DATE=$(date... (4 Replies)
Discussion started by: sebu
4 Replies

2. Homework & Coursework Questions

A simple Backup script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: All I have to do is write a script that will take two arguments. The first argument is a list which will contain... (1 Reply)
Discussion started by: Waffles
1 Replies

3. Solaris

Simple question: alias not working for root

OS = Solaris 8 Issue: alias not working for root, but working for regular users # grep root /etc/passwd root:x:0:1:Super-User:/:/sbin/sh # alias dir=ls # dir dir: not found # alias dir="ls -l" # dir dir: not found # alias dir='ls -l' # dir dir: not found # alias... (2 Replies)
Discussion started by: aixlover
2 Replies

4. Shell Programming and Scripting

How to create a simple shell script to backup

Hello - I am in process of deleting many files which are older than 4 weeks. For example I am inside: /subsystem/prod/ Files are with various extentions, but anything older than 4 weeks should be deleted. What would be the most simplest script to acheive this? (4 Replies)
Discussion started by: DallasT
4 Replies

5. UNIX for Dummies Questions & Answers

A very simple script, but alias won't work

I am new to unix and therefore I did a lot of reading before posting. So please, if this has been answered before, forgive me for re-posting and point me to the right place for the answer. I have spent many hours searching the net and read over 50 posts in this forum and even tried a few thing but... (20 Replies)
Discussion started by: sssccc
20 Replies

6. Shell Programming and Scripting

[bash] Simple backup (cp) script but incremental

Hi all, I would need a rather simple bash backup script that loops throught the (local) users and for each users backs up (cp!) its /home/username folder. About the functionalities: The script has to run every 2 hours (that's cron, so don't mind about that) and the files should be copied to... (12 Replies)
Discussion started by: laurens
12 Replies

7. Shell Programming and Scripting

Diff. Backup Script Using TAR. Should be simple.

I'm specifically trying to find help or insight on using the --incremental ('-G') option for creating a tar. Please resist the urge to tell me to use --listed-incremental ('-g') option. That's fairly well documented in the GNU tar manual. GNU tar 1.19 This is what the manual does say in section... (0 Replies)
Discussion started by: protienplant
0 Replies

8. Shell Programming and Scripting

alias a simple ls -l command

how do I alias the following command: ls -l |egrep 'drw|dr-|d--|d-w' The alias command needs single quotes and so does the above command, so this does not work: alias LSDIR 'ls -l |egrep 'drw|dr-|d--|d-w' ' My problem is how do I get a listing of only directories? Solaris 8 SUN Ultra 10... (4 Replies)
Discussion started by: ajp7701
4 Replies

9. Shell Programming and Scripting

Alias's & Functions - simple question

Having a memory lapse: If I redefine a command using an alias or a function - How do I access the "real" command without specifying an absoulte path: i.e. function man { /usr/bin/man |more } alias ls='/usr/bin/ls -l' How do I specify the ls or man command above without the... (6 Replies)
Discussion started by: kornshellmaven
6 Replies
Login or Register to Ask a Question