LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 07-23-2011, 05:11 PM   #16
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by grail View Post
markush's response is the correct one here. Try it for yourself and see what happens. Create three files starting with the letter g and see what
happens when you issue the command.
To do this won't I have to create some g files? Every time I try to write code and try to execute I always get this cannot access: no such file or directory.
 
Old 07-23-2011, 05:13 PM   #17
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by kenny53067 View Post
I understand this 100%
I'm trying to understand what things do so that I will be able to write code.

example: I didn't know that ls Memo would not work, but ls Memo? would list all files with Memo in the name. Now I know.
Ummm - that's actually wrong.

Code:
$ ls
Memo1  Memo10  Memo11  Memo12  Memo13  Memo14  Memo2  Memo3  Memo4
Code:
$ ls Memo?
Memo1  Memo2  Memo3  Memo4
Code:
$ ls Memo??
Memo10  Memo11  Memo12  Memo13  Memo14


Cheers,
Tink
 
Old 07-23-2011, 05:18 PM   #18
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by markush View Post
Hello,

@kenny53067, it seems you're posting from a Windows-computer. If you don't have Linux running, you should either boot a live-CD or use for example Virtualbox and install a Linux-distribution as a virtual machine. Then you can try out the code.

Markus
I have a VMware player and it has Fedora. There are no files on it so it is hard to run a script. As a matter of fact I have the terminal open the same time as this window.

Not to get off the subject, but is there a way to make the virtual machine stop turning off when is idle for to long?
 
Old 07-23-2011, 05:25 PM   #19
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Tinkster View Post
Ummm - that's actually wrong.

Code:
$ ls
Memo1  Memo10  Memo11  Memo12  Memo13  Memo14  Memo2  Memo3  Memo4
Code:
$ ls Memo?
Memo1  Memo2  Memo3  Memo4
Code:
$ ls Memo??
Memo10  Memo11  Memo12  Memo13  Memo14


Cheers,
Tink
Let me see if I understand, $ ls This list all files?

$ ls Memo? only list Memo with single digit numbers?

$ ls Memo?? only list Memo with double digit numbers?

Is this correct?
 
Old 07-23-2011, 05:31 PM   #20
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
You should in a terminal execute the following command (in your home-directory where you have write-permissions!!!)
Code:
for files in {1..20}; do touch Memo$files; done
this will create the files Memo1 up to Memo20, use them for some exercises.

Markus
 
1 members found this post helpful.
Old 07-23-2011, 05:33 PM   #21
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Quote:
Originally Posted by kenny53067 View Post
Let me see if I understand, $ ls This list all files?

$ ls Memo? only list Memo with single digit numbers?

$ ls Memo?? only list Memo with double digit numbers?

Is this correct?
No, this is not correct, the questionmark means any single character, it would also match for example "Memos".

Markus
 
1 members found this post helpful.
Old 07-23-2011, 05:34 PM   #22
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by kenny53067 View Post
Let me see if I understand, $ ls This list all files?

Is this correct?
Yep.

Quote:
Originally Posted by kenny53067 View Post
$ ls Memo? only list Memo with single digit numbers?

Is this correct?
Almost. It will work w/ ANY character, not just digits.

Quote:
Originally Posted by kenny53067 View Post
$ ls Memo?? only list Memo with double digit numbers?

Is this correct?
See one above.



Cheers,
Tink
 
1 members found this post helpful.
Old 07-23-2011, 05:49 PM   #23
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by markush View Post
You should in a terminal execute the following command (in your home-directory where you have write-permissions!!!)
Code:
for files in {1..20}; do touch Memo$files; done
this will create the files Memo1 up to Memo20, use them for some exercises.

Markus
Done, now I have Memo1-Memo20 files. Why is there a Memo1 and a Memo1~
 
Old 07-23-2011, 05:51 PM   #24
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Did you edit it? the vim editor for example creates a backupfile once you've made changes to a file, the backupfile has a "~" at it's end.

Markus
 
1 members found this post helpful.
Old 07-23-2011, 06:03 PM   #25
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by markush View Post
Did you edit it? the vim editor for example creates a backupfile once you've made changes to a file, the backupfile has a "~" at it's end.

Markus
So these are the same file, one is the original and one is a back-up.
 
Old 07-23-2011, 06:52 PM   #26
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
So these are the same file, one is the original and one is a back-up.
If one is the original and the other a back-up they can't be
the same, technically speaking ;}


Cheers,
Tink
 
Old 07-24-2011, 12:59 AM   #27
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Quote:
Originally Posted by kenny53067 View Post
So these are the same file, one is the original and one is a back-up.
The backup is made in the moment when you "could" have changed the file, which means you changed the text and wrote the changed file to the disk.

So both files can have the same content, but they are not the same like a symlink.

Markus
 
Old 07-24-2011, 10:59 AM   #28
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
ls does not list all files and directories, it does not list "hidden" files, that is those with first character .

To list all files and directories use ls -a
 
  


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
Help writing a script... linux_evangelist Linux - Newbie 7 11-15-2010 07:19 AM
Need help writing script Rustylinux SUSE / openSUSE 1 12-05-2006 10:05 AM
Script writing help, somebody? cwwilson721 Slackware 6 05-19-2006 09:40 PM
Writing a Script Nyc0n Linux - General 2 05-27-2002 07:21 PM
writing a Script spanky5125 Linux - Security 5 01-08-2002 09:22 AM

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

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