Bash aliases/functions and command line options

Soum Vhon

I want to set an alias to start nedit together with command line option -noautosave (due to text files up to 500MB). What seemed to be easy:

alias nn="nedit -noautosave $1 &"

just raises some error "Permission denied" of a different file and another error about unexpected EOF while looking for matching "'" and "unexpected end of file".

One solution I found after a Google Search would be to check the quotes, but I can't see any possible errors with them.

I also tried declaring a function:

function nn () { nedit -noautosave $1 &}

which also failed with same errors.

terdon

開くファイルの1つが指定されたサイズよりも大きい場合にのみ実行neditする-noautosave場合は、これを試してください(100Mを使用していますが、独自のサイズ制限を設定できます)。

function nn() { 
    big=0;
    let big+=$(find "$@" -size +100M|wc -l)
    if [ $big -gt 0 ]; then
     nedit -noautosave -- "$@" &
    else
     nedit -- "$@" &
    fi
}

差出人man nedit

   --  Treats all subsequent arguments as file names,
       even if they start with a dash.  This is so NEdit
       can access files that begin with the dash
       character.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

What is the command line for Indexing Options?

分類Dev

Openshift deploy with additional Maven command line options

分類Dev

Retrieving command line -D options in Java

分類Dev

Bash : command line with optional arguments

分類Dev

Problem with bash syntax on command line

分類Dev

Splitting bash command line argument

分類Dev

Passing command line arguments through Bash

分類Dev

Comments in a multi-line bash command

分類Dev

bash: Why are () causing error in script but not on the command line?

分類Dev

Handling command line options with multiple arguments for some flags

分類Dev

command line tool to list socket options that are currently set

分類Dev

Reading user command line input with PHP with readline, but bash is not default shell

分類Dev

How do I nice a for loop on the bash command line?

分類Dev

using set -o in a bash script to set command line editing

分類Dev

Export function from bash and run it through command line

分類Dev

Bash script to run a dotnet command line app getting ' as cli argument

分類Dev

How to create a user for Postgres from the command line for bash automation

分類Dev

edit bash command gcc to compile and execute in one line

分類Dev

How to read values from command line in bash script as given?

分類Dev

How can I shorten my command line (bash) prompt?

分類Dev

Is it possible to pass command-line arguments to @ARGV when using the -n or -p options?

分類Dev

What is the complete list of streaming command line options possible for Hadoop YARN version?

分類Dev

apt - Command line option 'i' [from -info] is not understood in combination with the other options

分類Dev

Cannot run bash script from crontab when it works from command line bash

分類Dev

explain the options of readlink command

分類Dev

bash: using scp in cron job fails, but runs succesfully when run from command line

分類Dev

How do I list all installed packages from the command line in bash / osX

分類Dev

bash read command splits line into words using space as delimiter even though space is not in IFS

分類Dev

How to get a launchd plist to diretly run a complex 1 line bash command?

Related 関連記事

  1. 1

    What is the command line for Indexing Options?

  2. 2

    Openshift deploy with additional Maven command line options

  3. 3

    Retrieving command line -D options in Java

  4. 4

    Bash : command line with optional arguments

  5. 5

    Problem with bash syntax on command line

  6. 6

    Splitting bash command line argument

  7. 7

    Passing command line arguments through Bash

  8. 8

    Comments in a multi-line bash command

  9. 9

    bash: Why are () causing error in script but not on the command line?

  10. 10

    Handling command line options with multiple arguments for some flags

  11. 11

    command line tool to list socket options that are currently set

  12. 12

    Reading user command line input with PHP with readline, but bash is not default shell

  13. 13

    How do I nice a for loop on the bash command line?

  14. 14

    using set -o in a bash script to set command line editing

  15. 15

    Export function from bash and run it through command line

  16. 16

    Bash script to run a dotnet command line app getting ' as cli argument

  17. 17

    How to create a user for Postgres from the command line for bash automation

  18. 18

    edit bash command gcc to compile and execute in one line

  19. 19

    How to read values from command line in bash script as given?

  20. 20

    How can I shorten my command line (bash) prompt?

  21. 21

    Is it possible to pass command-line arguments to @ARGV when using the -n or -p options?

  22. 22

    What is the complete list of streaming command line options possible for Hadoop YARN version?

  23. 23

    apt - Command line option 'i' [from -info] is not understood in combination with the other options

  24. 24

    Cannot run bash script from crontab when it works from command line bash

  25. 25

    explain the options of readlink command

  26. 26

    bash: using scp in cron job fails, but runs succesfully when run from command line

  27. 27

    How do I list all installed packages from the command line in bash / osX

  28. 28

    bash read command splits line into words using space as delimiter even though space is not in IFS

  29. 29

    How to get a launchd plist to diretly run a complex 1 line bash command?

ホットタグ

アーカイブ