Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #24

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lab-bash
Submodule lab-bash added at 689f07
74 changes: 74 additions & 0 deletions lab1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
1. Print in console "Hello World"
echo "Hello World"

2. Create a directory called `new_dir`
mkdir new_dir

3. Remove that directory.
rm -m new_dir

4. Copy the file `sed.txt` from the `lorem` folder to `lorem-copy` folder.
git mv lorem/sed.txt lorem-copy/
git commit -m"Move sed.txt from lorem to lorem-copy"

5. Copy the other two files from the `lorem folder` to `lorem-copy` folder in just one line with the pipe `;`.
git mv lorem/at.txt lorem/lorem.txt lorem-copy/;
echo "files moved successfully"

6. Show the `sed.txt` file content from the `lorem` folder
cat lorem/sed.txt

7. Show the `at.txt` file and `lorem.txt` file contents from `lorem` folder.
cat lorem/at.txt lorem/lorem.txt

8. Print the first 3 rows in `sed.txt` file from lorem-copy folder.
head -n 3 lorem-copy/sed.txt

9. Print the last 3 rows in `sed.txt` file from lorem-copy folder.
tail -n 3 lorem-copy/sed.txt

10. Add `Homo homini lupus.` at the end of `sed.txt` file from `lorem-copy` folder.
echo "Homo homini lupus" >> lorem-copy/sed.txt

11. Print the last 3 rows in `sed.txt` file from `lorem-copy` folder. You should see `Homo homini lupus.`.
tail -n 3 lorem-copy/sed.txt

12. Replace all `et` repetitions by `ET` in `at.txt` file from lorem folder to lorem-copy folder. Look the `sed` command.
sed -i 's/et/ET/g' lorem-copy/sed.txt

13. Find who is the system user.
whoami

14. Find which is your actual path.
git rev-parse --show-toplevel

15. List all files with the extension `.txt` in lorem folder.
git ls-files *.txt

16. Count the rows in `sed.txt` file from lorem folder. Look concatenate `cat` and `wc` with the pipe `|`.

17. Count the **files** start with `lorem` in all directories.
cat lorem/sed.txt | wc -1

18. Count how many times `et` appears in `at.txt` from `lorem` folder.
git show mean:lorem/at.txt | grep -o 'et' | wc -l

19. Count how many times `et` appears in `at.txt` from `lorem-copy` folder.
git show mean:lorem-copy/at.txt | grep -o 'et' | wc -l


20. Store your `name` in a variable with `read` command.
echo "Enter your name:"
read my_name

21. Print that variable.
my_name="Priyanka"
echo "Your name is: Priyanka"

22. Create a new directory named with variable `name`.
mkdir "Priyanka"

23. Remove that directory.
rmdir "Priyanka"

24. For each file in `lorem` folder, print the number of characters of its name.
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions lorem/sed.txt → lorem-copy/sed.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,
totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
totam rem aperiam, eaque ipsa quae ab illo inventore veritatis ET quasi architecto beatae vitae dicta sunt explicabo.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit,
sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amET, consectETur, adipisci velit,
sed quia non numquam eius modi tempora incidunt ut labore ET dolore magnam aliquam quaerat voluptatem.
Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam,
nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur,
vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?Homo homini lupus
Homo homini lupus