Score:0

I want to locate a file anywhere in my system and unzip it. But I want to run a shell script for it

tn flag

I used locate command to locate the zip file as find was not working in this case. Then run unzip it manually. I am learning shell scripting. How can I do it in shell script?

sudodus avatar
jp flag
Edit a text file, shellscript file, to include the command lines that you used manually, one line after the other, save the file and make it executable. It is a good idea to put a 'shebang' as the first line in the file; to make it use bash: `#!/bin/bash`. Please try, and if you need help to make it work correctly, please edit your original question to show your shellscript file as`code`.
sudodus avatar
jp flag
There are several good tutorials that you can find if you browse the internet. Use a suitable search string, for example **bash shellscript tutorial**
hr flag
See [How do I create a script file for terminal commands?](https://askubuntu.com/questions/223691/how-do-i-create-a-script-file-for-terminal-commands)
vanadium avatar
cn flag
Why is find not working in this case? This can perfectly be done with find in one go.
Fox Chasin avatar
tn flag
Find will only search in that directory. I am talking about anywhere in system.
sudodus avatar
jp flag
`find / -name filename` will search 'everywhere' (for the file 'filename'). You may need elevated permissions (prefix with `sudo`) to be able to search where a regular user lacks access. But `locate` is often much faster than `find`.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.