1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

remove hidden file using bash script

Discussion in 'Linux and Unix' started by binny18, Sep 6, 2019.

Thread Status:
Not open for further replies.
Advertisement
  1. binny18

    binny18 Thread Starter

    Joined:
    Sep 6, 2019
    Messages:
    8
    I have a temporary file under cd /tmp and file is music.tmp

    I want to remove the music.tmp file using bash shell scripting.

    What is that single command to execute under bash scripting and how to to do it?

    Let me know the answer
     
  2. Lee_BNY

    Lee_BNY

    Joined:
    May 28, 2009
    Messages:
    28
    First Name:
    Lee
    for x in [ /tmp ] ; do rm *.tmp; done
     
    Last edited: Sep 6, 2019
  3. binny18

    binny18 Thread Starter

    Joined:
    Sep 6, 2019
    Messages:
    8
    How to save that command in #!/bin/bash and how to create a directory for it and how to execute it?
     
  4. binny18

    binny18 Thread Starter

    Joined:
    Sep 6, 2019
    Messages:
    8
    Let me know how to create a directory first and how to edit using that directory and how to execute finally using ./ , how to do it on Ubuntu 18.04 TLS?
     
  5. Lee_BNY

    Lee_BNY

    Joined:
    May 28, 2009
    Messages:
    28
    First Name:
    Lee
    mkdir commands - makes directories
    vi commands creates your scripts, edit scripts.
    ./Scriptfilename - will execute it.

    https://ss64.com/bash/ - This link has useful commands. NOT all commands apply to Ubuntu
     
  6. binny18

    binny18 Thread Starter

    Joined:
    Sep 6, 2019
    Messages:
    8
    Vim /test

    #!/bin/bash
    for x in ( /tmp) ;
    do rm *.tmp;
    done
    Fi

    Chmod a+x /test
    ./test

    Is it correct?
     
  7. Lee_BNY

    Lee_BNY

    Joined:
    May 28, 2009
    Messages:
    28
    First Name:
    Lee
    #!/bin/bash

    for x in [ /tmp ];
    do rm *.tmp;
    done
    fi

    chmod a+x the script name , not the directory
     
  8. binny18

    binny18 Thread Starter

    Joined:
    Sep 6, 2019
    Messages:
    8
    I am not getting it, please let me know step by step how to do it and it says no such file or directory, please explain step by step command for it?
     
  9. binny18

    binny18 Thread Starter

    Joined:
    Sep 6, 2019
    Messages:
    8
    Please mention step by step before usijg bash script by giving an example for every command step by step?
     
  10. binny18

    binny18 Thread Starter

    Joined:
    Sep 6, 2019
    Messages:
    8
    Please provide all the commands line with bash scripting as i have sample.tmp file ubder cd /tmp

    Let me know all the steps for it.
     
  11. binny18

    binny18 Thread Starter

    Joined:
    Sep 6, 2019
    Messages:
    8
    how to edit for the permission before executing bash script and what is the single line command to edit in bash shell script to remove test.tmp under cd /tmp/ directory, let me know all steps from begining?
     
  12. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - remove hidden file
  1. david112211
    Replies:
    3
    Views:
    322
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1232609

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice