LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2016, 09:44 AM   #16
Arsenal1994
LQ Newbie
 
Registered: Nov 2016
Posts: 9

Original Poster
Rep: Reputation: Disabled

is it this link?
http://tldp.org/LDP/Bash-Beginners-G...ect_07_01.html
 
Old 11-15-2016, 09:46 AM   #17
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Arsenal1994 View Post
that will get you started...

in google or whatever you can search

variables bash Linux
 
Old 11-23-2016, 11:32 AM   #18
Arsenal1994
LQ Newbie
 
Registered: Nov 2016
Posts: 9

Original Poster
Rep: Reputation: Disabled
This is what i have so far for my delete script. Im having problems trying to deal with wildcards and the absolute and relative paths and deleting multiple files at the same time.
Code:
#!/bin/sh

if [ -d ~/my-applications/bin/dustbin ]
then
echo "dustbin already exists"
else
mkdir ~/my-applications/bin/dustbin
echo "dustbin has been created"
fi

if [ -f ~/my-applications/bin/dustbin/$1 ]
then
echo "file already exists. It will be overwritten"
rm ~/my-applications/bin/dustbin/$1
mv $1 ~/my-applications/bin/dustbin/
else 
mv $1 ~/my-applications/bin/dustbin/
echo "file has been moved
fi
 
Old 11-23-2016, 01:51 PM   #19
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,216

Rep: Reputation: 6100Reputation: 6100Reputation: 6100Reputation: 6100Reputation: 6100Reputation: 6100Reputation: 6100Reputation: 6100Reputation: 6100Reputation: 6100Reputation: 6100
Absolute paths begin with a / and relative paths do not. Wild cards will be expanded on the command line so you can check for the number of arguments. You also need consider subdirectories.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Two scripts, delete and restore highland Linux - Newbie 3 11-24-2014 09:10 PM
I need a script to Delete Selected BackupFiles and Restore selected backup file finalwar Linux - Newbie 3 07-20-2010 02:10 AM
Site definitely hacked. Can't delete files to restore backup. painterj Linux - Security 9 04-10-2010 07:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:10 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